]> git.saurik.com Git - wxWidgets.git/commitdiff
implement SetFocusFromKbd() to select all text in the controls whose dialog code...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Apr 2002 00:32:14 +0000 (00:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 21 Apr 2002 00:32:14 +0000 (00:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15224 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index a65bdbc19188b3235bc26bbc34236f5c9634f190..2218c201e918b439a06b7ce7ae7f635d809b3469 100644 (file)
@@ -86,6 +86,7 @@ public:
     virtual bool Enable( bool enable = TRUE );
 
     virtual void SetFocus();
+    virtual void SetFocusFromKbd();
 
     virtual bool Reparent(wxWindowBase *newParent);
 
index 77589902e52de74badfdc01b09e54c06d7afcf75..b1a3914509a9f4f981648c93339a29151a20bd77 100644 (file)
@@ -458,6 +458,20 @@ void wxWindowMSW::SetFocus()
     }
 }
 
+void wxWindowMSW::SetFocusFromKbd()
+{
+    wxWindowBase::SetFocusFromKbd();
+
+    // when the focus is given to the control with DLGC_HASSETSEL style from
+    // keyboard its contents should be entirely selected: this is what
+    // ::IsDialogMessage() does and so we should do it as well to provide the
+    // same LNF as the native programs
+    if ( ::SendMessage(GetHwnd(), WM_GETDLGCODE, 0, 0) & DLGC_HASSETSEL )
+    {
+        ::SendMessage(GetHwnd(), EM_SETSEL, 0, -1);
+    }
+}
+
 // Get the window with the focus
 wxWindow *wxWindowBase::FindFocus()
 {