From: Vadim Zeitlin Date: Sat, 8 Jun 2002 21:32:36 +0000 (+0000) Subject: reenabled WS_EX_CONTROLPARENT style together with a check that the focus window is... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/70a5eef8f10ecc86dbf1707fe71535d88e31e24b reenabled WS_EX_CONTROLPARENT style together with a check that the focus window is not disabled or hidden git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/window.cpp b/src/msw/window.cpp index e762e88e84..ff531d4eaa 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1165,15 +1165,11 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const } // to make the dialog navigation work with the nested panels we must - // use this style but, unfortunately, it hangs NT4 in some situations - // so we shouldn't use it -- even though it means that keyboard accels - // in, e.g. wxWizard, don't work -#if 0 + // use this style if ( flags & wxTAB_TRAVERSAL ) { *exstyle |= WS_EX_CONTROLPARENT; } -#endif // 0 } return style; @@ -2084,10 +2080,18 @@ 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 ) { - if ( ::IsDialogMessage(GetHwnd(), msg) ) + // ::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 + HWND hwndFocus = ::GetFocus(); + if ( !hwndFocus || + ::IsWindowEnabled(hwndFocus) && ::IsWindowVisible(hwndFocus) ) { - // IsDialogMessage() did something... - return TRUE; + if ( ::IsDialogMessage(GetHwnd(), msg) ) + { + // IsDialogMessage() did something... + return TRUE; + } } } }