Don't restore selection when a text field receives focus on OS X
This makes wxTextCtrl behave like the native text controls and, in particular, makes it select its entire text when it gets focus (incidentally, this is also how it behaves under the other platforms). Closes #9521.
This commit is contained in:
committed by
Vadim Zeitlin
parent
fea37f4984
commit
899b56c4a7
@@ -1093,18 +1093,6 @@ bool wxNSTextFieldControl::becomeFirstResponder(WXWidget slf, void *_cmd)
|
||||
s_widgetBecomingFirstResponder = slf;
|
||||
bool retval = wxWidgetCocoaImpl::becomeFirstResponder(slf, _cmd);
|
||||
s_widgetBecomingFirstResponder = nil;
|
||||
if ( retval )
|
||||
{
|
||||
NSText* editor = [m_textField currentEditor];
|
||||
if ( editor )
|
||||
{
|
||||
long textLength = [[m_textField stringValue] length];
|
||||
m_selStart = wxMin(textLength,wxMax(m_selStart,0)) ;
|
||||
m_selEnd = wxMax(0,wxMin(textLength,m_selEnd)) ;
|
||||
|
||||
[editor setSelectedRange:NSMakeRange(m_selStart, m_selEnd-m_selStart)];
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user