From 899b56c4a7fa315f7a636c9678b367ded3ac5377 Mon Sep 17 00:00:00 2001 From: ARATA Mizuki Date: Fri, 4 Sep 2015 14:36:27 +0900 Subject: [PATCH] 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. --- src/osx/cocoa/textctrl.mm | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index a86a4d2f63..46aa8f3caa 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -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; }