From 3f8502f7fc4f58ee97cc05adf876c44e04a1498b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 16 Sep 2011 13:23:05 +0000 Subject: [PATCH] Fix checked state for the popup menu items in the events generated by them. We incorrectly passed the sign-extended int id to ::GetMenuState() function that expects an unsigned WORD id, so it never found the item if the WORD id had the high bit set. Fix this by correctly passing the unsigned id to it. Closes #11644. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69099 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/menu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index fe8b4a51dd..543ed55116 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -956,7 +956,10 @@ bool wxMenu::MSWCommand(WXUINT WXUNUSED(param), WXWORD id_) // 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 - UINT menuState = ::GetMenuState(GetHmenu(), id, MF_BYCOMMAND); + // + // 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); } -- 2.45.2