Allow wx parents a chance to handle events fired by non-wx children. (i.e. wxActiveX controls)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36450 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -124,24 +124,36 @@ bool wxEventLoop::IsChildOfCriticalWindow(wxWindowMSW *win)
|
|||||||
bool wxEventLoop::PreProcessMessage(WXMSG *msg)
|
bool wxEventLoop::PreProcessMessage(WXMSG *msg)
|
||||||
{
|
{
|
||||||
HWND hwnd = msg->hwnd;
|
HWND hwnd = msg->hwnd;
|
||||||
wxWindow * const wndThis = wxGetWindowFromHWND((WXHWND)hwnd);
|
wxWindow *wndThis = wxGetWindowFromHWND((WXHWND)hwnd);
|
||||||
wxWindow *wnd;
|
wxWindow *wnd;
|
||||||
|
|
||||||
// this may happen if the event occurred in a standard modeless dialog (the
|
wxWindow* parent = NULL;
|
||||||
// only example of which I know of is the find/replace dialog) - then call
|
|
||||||
// IsDialogMessage() to make TAB navigation in it work
|
// this might happen if we're in a modeless dialog, or if a wx control has
|
||||||
|
// children which themselves were not created by wx (i.e. wxActiveX control children)
|
||||||
if ( !wndThis )
|
if ( !wndThis )
|
||||||
{
|
{
|
||||||
// we need to find the dialog containing this control as
|
|
||||||
// IsDialogMessage() just eats all the messages (i.e. returns true for
|
|
||||||
// them) if we call it for the control itself
|
|
||||||
while ( hwnd && ::GetWindowLong(hwnd, GWL_STYLE) & WS_CHILD )
|
while ( hwnd && ::GetWindowLong(hwnd, GWL_STYLE) & WS_CHILD )
|
||||||
{
|
{
|
||||||
hwnd = ::GetParent(hwnd);
|
hwnd = ::GetParent(hwnd);
|
||||||
|
|
||||||
|
// If the control has a wx parent, break and give the parent a chance
|
||||||
|
// to process the window message
|
||||||
|
wndThis = wxGetWindowFromHWND((WXHWND)hwnd);
|
||||||
|
if (wndThis != NULL)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !wndThis ){
|
||||||
|
// this may happen if the event occurred in a standard modeless dialog (the
|
||||||
|
// only example of which I know of is the find/replace dialog) - then call
|
||||||
|
// IsDialogMessage() to make TAB navigation in it work
|
||||||
|
|
||||||
|
// NOTE: IsDialogMessage() just eats all the messages (i.e. returns true for
|
||||||
|
// them) if we call it for the control itself
|
||||||
return hwnd && ::IsDialogMessage(hwnd, msg) != 0;
|
return hwnd && ::IsDialogMessage(hwnd, msg) != 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( !AllowProcessing(wndThis) )
|
if ( !AllowProcessing(wndThis) )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user