// 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
/////////////////////////////////////////////////////////////////////////////
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)
// 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 */);
}
else // right
{
- if ( ++currentNew == (int)count )
+ if ( ++currentNew == count )
currentNew = 0;
}
// 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);
void wxMenuBar::OnDismiss()
{
- ReleaseCapture();
+ ReleaseMouse();
if ( m_current != -1 )
{