X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8cb172b4f12fae80b06d5936108a1bc7f2521674..30a72e62977e4c532ae2f265db72535a5cccbbab:/src/univ/menu.cpp diff --git a/src/univ/menu.cpp b/src/univ/menu.cpp index 9c24407cd3..1d819ad0fe 100644 --- a/src/univ/menu.cpp +++ b/src/univ/menu.cpp @@ -5,7 +5,7 @@ // Modified by: // Created: 25.08.00 // RCS-ID: $Id$ -// Copyright: (c) 2000 Vadim Zeitlin +// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -601,10 +601,12 @@ void wxPopupMenuWindow::ClickItem(wxMenuItem *item) wxASSERT_MSG( !item->IsSeparator() && !item->IsSubMenu(), _T("can't click this item") ); - m_menu->ClickItem(item); + wxMenu* menu = m_menu; // close all menus DismissAndNotify(); + + menu->ClickItem(item); } void wxPopupMenuWindow::OpenSubmenu(wxMenuItem *item, InputMethod how) @@ -1963,7 +1965,7 @@ bool wxMenuBar::ProcessMouseEvent(const wxPoint& pt) // show the menu if we know that we should, even if we hadn't been showing // it before (this may happen if the previous menu was disabled) - if ( m_shouldShowMenu ) + if ( m_shouldShowMenu && !m_menuShown) { // open the new menu if the old one we closed had been opened PopupCurrentMenu(FALSE /* don't select first item - as Windows does */); @@ -2223,6 +2225,11 @@ void wxMenuBar::PopupCurrentMenu(bool selectFirst) // that we pass 0 as width to position the menu exactly below the // item, not to the right of it wxRect rectItem = GetItemRect(m_current); + + // Release mouse, because the menu will get the capture. + if (HasCapture()) + ReleaseMouse(); + m_menuShown->Popup(ClientToScreen(rectItem.GetPosition()), wxSize(0, rectItem.GetHeight()), selectFirst);