From 57b708aebd64b2a04613d027ec9b0c5208ff9b17 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 23 Jun 2013 13:08:18 +0000 Subject: [PATCH] Use child MDI frame menu items in preference to the parent frame ones. Look for the item with the given ID in the child frame menu bar first, before looking in the parent frame menu bar. This ensures that if an item is disabled by the parent frame but then reenabled by the child one, it still generates commands as expected instead of being completely ignored. See #14314. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/mdi.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index db1997bdd6..1e5a7f39f5 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -428,11 +428,14 @@ void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu) wxMenuItem *wxMDIParentFrame::FindItemInMenuBar(int menuId) const { - wxMenuItem *item = wxFrame::FindItemInMenuBar(menuId); - if ( !item && GetActiveChild() ) - { - item = GetActiveChild()->FindItemInMenuBar(menuId); - } + // We must look in the child menu first: if it has an item with the same ID + // as in our own menu bar, the child item should be used to determine + // whether it's currently enabled. + wxMenuItem *item = GetActiveChild() + ? GetActiveChild()->FindItemInMenuBar(menuId) + : NULL; + if ( !item ) + item = wxFrame::FindItemInMenuBar(menuId); if ( !item && m_windowMenu ) item = m_windowMenu->FindItem(menuId); -- 2.45.2