fixed the checked flag value for events from check items in popup menus (patch 1079015; closes bug 1071598)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31671 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-01-31 15:11:10 +00:00
parent a152561c76
commit 36f1f45649

View File

@@ -642,16 +642,12 @@ void wxMenu::SetTitle(const wxString& label)
bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id)
{
// ignore commands from the menu title
// NB: VC++ generates wrong assembler for `if ( id != idMenuTitle )'!!
if ( id != (WXWORD)idMenuTitle )
{
// VZ: previosuly, the command int was set to id too which was quite
// useless anyhow (as it could be retrieved using GetId()) and
// uncompatible with wxGTK, so now we use the command int instead
// to pass the checked status
UINT menuState = ::GetMenuState(GetHmenu(), id, MF_BYCOMMAND) ;
SendEvent(id, menuState & MF_CHECKED);
// get the checked status of the command: notice that menuState is the
// old state of the menu, so the test for MF_CHECKED must be inversed
UINT menuState = ::GetMenuState(GetHmenu(), id, MF_BYCOMMAND);
SendEvent(id, !(menuState & MF_CHECKED));
}
return true;