diff --git a/include/wx/msw/mdi.h b/include/wx/msw/mdi.h index afef0664a4..caf235fd56 100644 --- a/include/wx/msw/mdi.h +++ b/include/wx/msw/mdi.h @@ -110,6 +110,9 @@ public: #endif // wxUSE_MENUS protected: + // override to pass menu/toolbar events to the active child first + virtual bool TryBefore(wxEvent& event); + #if wxUSE_MENUS_NATIVE virtual void InternalSetMenuBar(); #endif // wxUSE_MENUS_NATIVE diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 6ecd832ea5..db1997bdd6 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -577,19 +577,6 @@ WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message, MSWDefWindowProc(message, wParam, lParam); processed = true; } - else // Not a system command. - { - // Menu (and toolbar) events should be sent to the active - // child first and only be processed by the parent frame if - // they're not handled there. - if ( wxMDIChildFrame* child = GetActiveChild() ) - { - processed = child->MSWHandleMessage(&rc, - message, - wParam, - lParam); - } - } } break; @@ -708,6 +695,20 @@ void wxMDIParentFrame::OnMDICommand(wxCommandEvent& event) #endif // wxUSE_MENUS +bool wxMDIParentFrame::TryBefore(wxEvent& event) +{ + // menu (and toolbar) events should be sent to the active child frame + // first, if any + if ( event.GetEventType() == wxEVT_MENU ) + { + wxMDIChildFrame * const child = GetActiveChild(); + if ( child && child->ProcessWindowEventLocally(event) ) + return true; + } + + return wxMDIParentFrameBase::TryBefore(event); +} + WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)