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
This commit is contained in:
Vadim Zeitlin
2002-04-21 00:32:14 +00:00
parent d577d610a3
commit ddf9d04fe9
2 changed files with 15 additions and 0 deletions

View File

@@ -86,6 +86,7 @@ public:
virtual bool Enable( bool enable = TRUE );
virtual void SetFocus();
virtual void SetFocusFromKbd();
virtual bool Reparent(wxWindowBase *newParent);

View 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()
{