When inserting a new menu don't try to find th eposition of the current one

if the menubar is not yet attached.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2004-01-20 02:57:06 +00:00
parent b8f896a10a
commit 3d27b5746f

View 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);