Fix int field of wxCommandEvent generated by popup menu items in wxMSW.

The intention of the code generating the event for popup menu items was to
pass false (0) or true (1) in the int field of wxCommandEvent to indicate
whether the item was checked or not but, because wxMenu::SendEvent() takes int
as second argument and not book, we passed either 0 or MF_CHECKED (== 8).

Fix this by correctly passing a boolean for checkable items.

See #11644.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69100 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-09-16 13:23:10 +00:00
parent 3f8502f7fc
commit 99893e284f

View File

@@ -960,7 +960,7 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_)
// Also notice that we must pass unsigned id_ and not sign-extended id // Also notice that we must pass unsigned id_ and not sign-extended id
// to ::GetMenuState() as this is what it expects. // to ::GetMenuState() as this is what it expects.
UINT menuState = ::GetMenuState(GetHmenu(), id_, MF_BYCOMMAND); UINT menuState = ::GetMenuState(GetHmenu(), id_, MF_BYCOMMAND);
SendEvent(id, menuState & MF_CHECKED); SendEvent(id, menuState & MF_CHECKED ? 1 : 0);
} }
return true; return true;