Don't send events for already selected radio popup menu items.

Selecting an already selected radio menu item didn't generate any events in
wxGTK nor in wxMSW with the top level (i.e. attached to a menu bar) menus but
did send them for popup menus under MSW.

Make the last case consistent with the rest of them and don't send any events
in this case neither.

Closes #16891.
This commit is contained in:
Vadim Zeitlin
2015-03-23 01:10:00 +01:00
parent 3cd55d9775
commit fec1dcbd73
2 changed files with 16 additions and 9 deletions

View File

@@ -141,6 +141,7 @@ wxMSW:
- Fix appearance of checked disabled wxToolBar tools with custom images.
- Fix reading of not NUL-terminated strings using wxRegKey (Steffen Olszewski).
- Fix unexpected change in MDI children order after showing a file dialog.
- Don't send events for already selected radio popup menu items (Kinaou Hervé).
wxOSX/Cocoa:

View File

@@ -969,7 +969,12 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_)
// update the check item when it's clicked
wxMenuItem * const item = FindItem(id);
if ( item && item->IsCheckable() )
if ( item )
{
if ( (item->GetKind() == wxITEM_RADIO) && item->IsChecked() )
return true;
if ( item->IsCheckable() )
{
item->Toggle();
@@ -981,6 +986,7 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_)
UINT menuState = ::GetMenuState(GetHmenu(), id_, MF_BYCOMMAND);
checked = (menuState & MF_CHECKED) != 0;
}
}
SendEvent(id, checked);
}