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:
parent
3cd55d9775
commit
fec1dcbd73
@ -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:
|
||||
|
||||
|
@ -969,17 +969,23 @@ 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 )
|
||||
{
|
||||
item->Toggle();
|
||||
if ( (item->GetKind() == wxITEM_RADIO) && item->IsChecked() )
|
||||
return true;
|
||||
|
||||
// Get the status of the menu item: note that it has been just changed
|
||||
// by Toggle() above so here we already get the new state of the item.
|
||||
//
|
||||
// Also notice that we must pass unsigned id_ and not sign-extended id
|
||||
// to ::GetMenuState() as this is what it expects.
|
||||
UINT menuState = ::GetMenuState(GetHmenu(), id_, MF_BYCOMMAND);
|
||||
checked = (menuState & MF_CHECKED) != 0;
|
||||
if ( item->IsCheckable() )
|
||||
{
|
||||
item->Toggle();
|
||||
|
||||
// Get the status of the menu item: note that it has been just changed
|
||||
// by Toggle() above so here we already get the new state of the item.
|
||||
//
|
||||
// Also notice that we must pass unsigned id_ and not sign-extended id
|
||||
// to ::GetMenuState() as this is what it expects.
|
||||
UINT menuState = ::GetMenuState(GetHmenu(), id_, MF_BYCOMMAND);
|
||||
checked = (menuState & MF_CHECKED) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
SendEvent(id, checked);
|
||||
|
Loading…
Reference in New Issue
Block a user