diff --git a/docs/changes.txt b/docs/changes.txt index 6e22f28d39..85541a9e5f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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: diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 1a1e6e0038..5045253449 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -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);