]> git.saurik.com Git - wxWidgets.git/commitdiff
Use child MDI frame menu items in preference to the parent frame ones.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 23 Jun 2013 13:08:18 +0000 (13:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 23 Jun 2013 13:08:18 +0000 (13:08 +0000)
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

index db1997bdd6f7aa465e8c0ddb420e27aeddd86ae7..1e5a7f39f5e4f0aa078baeb4c9d23108c79eb720 100644 (file)
@@ -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);