Add MSWGetFocusHWND to allow focus a subwindow
Under MSW allow override which subwindow will be focused for composite windows which are implemented not as a set of wxControl (i.e. using only Windows native controls).
This commit is contained in:
@@ -577,7 +577,7 @@ void wxWindowMSW::SetId(wxWindowID winid)
|
||||
|
||||
void wxWindowMSW::SetFocus()
|
||||
{
|
||||
HWND hWnd = GetHwnd();
|
||||
HWND hWnd = MSWGetFocusHwnd();
|
||||
wxCHECK_RET( hWnd, wxT("can't set focus to invalid window") );
|
||||
|
||||
::SetLastError(0);
|
||||
@@ -599,13 +599,15 @@ void wxWindowMSW::SetFocus()
|
||||
|
||||
void wxWindowMSW::SetFocusFromKbd()
|
||||
{
|
||||
HWND hWnd = MSWGetFocusHwnd();
|
||||
|
||||
// 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 )
|
||||
if ( ::SendMessage(hWnd, WM_GETDLGCODE, 0, 0) & DLGC_HASSETSEL )
|
||||
{
|
||||
::SendMessage(GetHwnd(), EM_SETSEL, 0, -1);
|
||||
::SendMessage(hWnd, EM_SETSEL, 0, -1);
|
||||
}
|
||||
|
||||
// do this after (maybe) setting the selection as like this when
|
||||
|
Reference in New Issue
Block a user