From: Vadim Zeitlin Date: Sun, 21 Apr 2002 00:32:14 +0000 (+0000) Subject: implement SetFocusFromKbd() to select all text in the controls whose dialog code... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ddf9d04fe9c4aa5d7319c5eb7eabcf781a157c3d implement SetFocusFromKbd() to select all text in the controls whose dialog code has DLGC_HASSETSEL git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15224 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index a65bdbc191..2218c201e9 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -86,6 +86,7 @@ public: virtual bool Enable( bool enable = TRUE ); virtual void SetFocus(); + virtual void SetFocusFromKbd(); virtual bool Reparent(wxWindowBase *newParent); diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 77589902e5..b1a3914509 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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() {