[ wxwindows-Bugs-1639891 ] Fix found for menu check item not working
in WinCE
SourceForge.net
noreply at sourceforge.net
Fri Jan 19 14:10:34 PST 2007
Bugs item #1639891, was opened at 2007-01-19 14:10
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1639891&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: WinCE specific
Group: Must fix
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Mickey Mestel (mickm1)
Assigned to: Julian Smart (juliansmart)
Summary: Fix found for menu check item not working in WinCE
Initial Comment:
hi,
i reported a problem a bit ago about the menu check item in WinCE. when receiving a menu event, in the event handler function event.IsChecked() always returns true. i have verified that the action is the same in 2.6.3 and 2.8.0. i traced this down to the following function in .../src/msw/wince/tbarwce.cpp
bool wxToolMenuBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id)
{
wxToolBarToolBase *tool = FindById((int)id);
if ( !tool )
{
if (m_menuBar)
{
wxMenuItem *item = m_menuBar->FindItem(id);
if (item && item->IsCheckable())
{
item->Toggle();
}
}
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED);
event.SetEventObject(this);
event.SetId(id);
event.SetInt(id);
return GetEventHandler()->ProcessEvent(event);
}
you can see that the method event.SetInt(id) always sets the variable m_commandInt to the value of id, regardless of what happened with toggling the check item. event.IsChecked() simply returns the value of m_commandInt, so it is always returning a positive value.
i did the following and it works on my system. when the event is for a check action, then we want to set m_commandInt to 0 or 1 depending on which way we toggled, so that event.IsChecked() will give us what we want. i'm assuming that in any other case, it is ok to set m_commandInt to the value of id, although i don't know that for certain as i haven't traced this for every possible scenario. as i know of though, this is the only event, at least menu wise, that isn't working.
here is the code that i changed:
bool wxToolMenuBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id)
{
wxToolBarToolBase *tool = FindById((int)id);
if ( !tool )
{
int checked = mid;
if (m_menuBar)
{
wxMenuItem *item = m_menuBar->FindItem(id);
if (item && item->IsCheckable())
{
item->Toggle();
check = item->IsChecked() ? 1 : 0;
}
}
wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED);
event.SetEventObject(this);
event.SetId(id);
event.SetInt(checked);
return GetEventHandler()->ProcessEvent(event);
}
thanks,
mickm
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1639891&group_id=9863
More information about the wx-dev
mailing list