]> git.saurik.com Git - wxWidgets.git/commitdiff
select the whole text in the single line text control when its SetFocus() is called...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 18 Apr 2002 23:32:41 +0000 (23:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 18 Apr 2002 23:32:41 +0000 (23:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15203 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/textctrl.h
src/msw/textctrl.cpp

index c5e03295f3b52f537e4ab90dbfa8df53babd7f16..07fa37fe8b3082decdbaab1f822a1ee17aa75913 100644 (file)
@@ -128,6 +128,7 @@ public:
     // Implementation from now on
     // --------------------------
 
+    virtual void SetFocus();
     virtual void SetWindowStyleFlag(long style);
 
     virtual void Command(wxCommandEvent& event);
index a5acb508d261aa9ff7b448750d35476c86ad42e4..1a0b6c5f406748ea087fc88c9375c5e28cde3d7c 100644 (file)
@@ -1244,6 +1244,24 @@ long wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
     return wxTextCtrlBase::MSWWindowProc(nMsg, wParam, lParam);
 }
 
+void wxTextCtrl::SetFocus()
+{
+    wxTextCtrlBase::SetFocus();
+
+    // to be consistent with the standard Windows behaviour we select all text
+    // in the single line edit controls when the user TABs to them and also, to
+    // be consistent with this behaviour in turn, do it whenever SetFocus() is
+    // called as well
+    if ( !HasFlag(wxTE_MULTILINE) )
+    {
+        SetSelection(-1, -1);
+    }
+}
+
+// ----------------------------------------------------------------------------
+// text control event processing
+// ----------------------------------------------------------------------------
+
 bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
 {
     switch (param)