X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fb35f0c79ca42d888391f0394dec56d04cf71890..c1cb41536a6106968b546cdba8d3d89805f802bc:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index e088336c4d..ff531d4eaa 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1163,6 +1163,13 @@ WXDWORD wxWindowMSW::MSWGetStyle(long flags, WXDWORD *exstyle) const *exstyle |= WS_EX_DLGMODALFRAME; break; } + + // to make the dialog navigation work with the nested panels we must + // use this style + if ( flags & wxTAB_TRAVERSAL ) + { + *exstyle |= WS_EX_CONTROLPARENT; + } } return style; @@ -2073,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; + } } } }