]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix int field of wxCommandEvent generated by popup menu items in wxMSW.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 16 Sep 2011 13:23:10 +0000 (13:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 16 Sep 2011 13:23:10 +0000 (13:23 +0000)
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

src/msw/menu.cpp

index 543ed5511637b708fd12b390a4d7aa4f09972213..8e11eeb1d319e92ed20fbe88c0657ccbdefca545 100644 (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
         // to ::GetMenuState() as this is what it expects.
         UINT menuState = ::GetMenuState(GetHmenu(), id_, MF_BYCOMMAND);
-        SendEvent(id, menuState & MF_CHECKED);
+        SendEvent(id, menuState & MF_CHECKED ? 1 : 0);
     }
 
     return true;