]> git.saurik.com Git - wxWidgets.git/commitdiff
When inserting a new menu don't try to find th eposition of the current one
authorDavid Elliott <dfe@tgwbd.org>
Tue, 20 Jan 2004 02:57:06 +0000 (02:57 +0000)
committerDavid Elliott <dfe@tgwbd.org>
Tue, 20 Jan 2004 02:57:06 +0000 (02:57 +0000)
if the menubar is not yet attached.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/menu.cpp

index 4be9908fccedcf4c06b49fccb594423e0bce1414..478048e7037bf5a9339b53e49b93bdeb2782ceb9 100644 (file)
@@ -977,7 +977,8 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
 {
     // Find out which MSW item before which we'll be inserting before
     // wxMenuBarBase::Insert is called and GetMenu(pos) is the new menu.
-    int mswpos = (pos == m_menus.GetCount())
+    // If IsAttached() is false this won't be used anyway
+    int mswpos = (!IsAttached() || (pos == m_menus.GetCount()))
         ?   -1 // append the menu
         :   MSWPositionForWxMenu(GetMenu(pos),pos);