if ( !label.empty() )
{
if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
- (unsigned)idMenuTitle, m_title) ||
+ (unsigned)idMenuTitle, m_title.wx_str()) ||
!::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
{
wxLogLastError(wxT("InsertMenu"));
#else
if ( !ModifyMenu(hMenu, 0u,
MF_BYPOSITION | MF_STRING,
- (unsigned)idMenuTitle, m_title) )
+ (unsigned)idMenuTitle, m_title.wx_str()) )
{
wxLogLastError(wxT("ModifyMenu"));
}
if ( item && item->IsCheckable() )
item->Toggle();
- // get the checked status of the menu item: note that menuState is the
- // old state of the menu, so the test for MF_CHECKED must be inverted
+ // 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);
- SendEvent(id, !(menuState & MF_CHECKED));
+ SendEvent(id, menuState & MF_CHECKED);
}
return true;
{
if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING,
(UINT)(*it)->GetHMenu(),
- m_titles[i]) )
+ m_titles[i].wx_str()) )
{
wxLogLastError(wxT("AppendMenu"));
}
#else
if ( ::ModifyMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_STRING | flagsOld,
- id, label) == (int)0xFFFFFFFF )
+ id, label.wx_str()) == (int)0xFFFFFFFF )
{
wxLogLastError(wxT("ModifyMenu"));
}
if ( !::InsertMenu(GetHmenu(), (UINT)mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING,
- (UINT)GetHmenuOf(menu), title) )
+ (UINT)GetHmenuOf(menu), title.wx_str()) )
{
wxLogLastError(wxT("InsertMenu"));
}
#else
if ( !::InsertMenu(GetHmenu(), mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING,
- (UINT)GetHmenuOf(menu), title) )
+ (UINT)GetHmenuOf(menu), title.wx_str()) )
{
wxLogLastError(wxT("InsertMenu"));
}
}
#else
if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
- (UINT)submenu, title) )
+ (UINT)submenu, title.wx_str()) )
{
wxLogLastError(wxT("AppendMenu"));
}