From 573a1586187a35f6c7f2e83c82e48a75cc080046 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 15 Jun 2002 20:09:15 +0000 Subject: [PATCH] fix for dialog navigation in the modal dialogs: do call IsDialogMessage() in this case git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15859 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/window.cpp | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 24d9578620..843b912b13 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1916,14 +1916,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) // here we try to do all the job which ::IsDialogMessage() usually does // internally #if 1 - bool bProcess = TRUE; - if ( msg->message != WM_KEYDOWN ) - bProcess = FALSE; - - if ( bProcess && (HIWORD(msg->lParam) & KF_ALTDOWN) == KF_ALTDOWN ) - bProcess = FALSE; - - if ( bProcess ) + if ( msg->message == WM_KEYDOWN ) { bool bCtrlDown = wxIsCtrlDown(); bool bShiftDown = wxIsShiftDown(); @@ -1940,6 +1933,8 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) bool bForward = TRUE, bWindowChange = FALSE; + // should we process this message specially? + bool bProcess = TRUE; switch ( msg->wParam ) { case VK_TAB: @@ -2084,24 +2079,21 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) // place edit control from being closed with Escape in a dialog if ( msg->message != WM_KEYDOWN || msg->wParam != VK_ESCAPE ) { - // ::IsDialogMessage() can enter in an infinite loop when - // WS_EX_CONTROLPARENT is specified and the currently focused - // window is disabled or hidden, so don't call it in this case + // ::IsDialogMessage() can enter in an infinite loop when the + // currently focused window is disabled or hidden and its parent + // has WS_EX_CONTROLPARENT style, so don't call it in this case bool canSafelyCallIsDlgMsg = TRUE; - HWND hwndFocus = ::GetFocus(); - while ( hwndFocus ) + HWND hwnd = ::GetFocus(); + if ( hwnd && !(::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd)) ) { - if ( !::IsWindowEnabled(hwndFocus) || - !::IsWindowVisible(hwndFocus) ) + hwnd = ::GetParent(hwnd); + if ( hwnd && + (::GetWindowLong(hwnd, GWL_STYLE) & WS_EX_CONTROLPARENT) ) { // it would enter an infinite loop if we do this! canSafelyCallIsDlgMsg = FALSE; - - break; } - - hwndFocus = ::GetParent(hwndFocus); } if ( canSafelyCallIsDlgMsg && ::IsDialogMessage(GetHwnd(), msg) ) -- 2.50.0