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)
}
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 )
{