- if ( m_bChecked != bDoCheck ) {
- CheckMenuItem((HMENU)m_pParentMenu->GetHMenu(), m_idItem,
- MF_BYCOMMAND | (bDoCheck ? MF_CHECKED : MF_UNCHECKED));
+ UINT id = GetRealId();
+ UINT flagsOld = ::GetMenuState(hMenu, id, MF_BYCOMMAND);
+ if ( flagsOld == 0xFFFFFFFF )
+ {
+ wxLogLastError("GetMenuState");
+ }
+ else
+ {
+ if ( IsSubMenu() )
+ {
+ // high byte contains the number of items in a submenu for submenus
+ flagsOld &= 0xFF;
+ flagsOld |= MF_POPUP;
+ }
+
+ LPCTSTR data;
+#if wxUSE_OWNER_DRAWN
+ if ( IsOwnerDrawn() )
+ {
+ flagsOld |= MF_OWNERDRAW;
+ data = (LPCTSTR)this;
+ }
+ else
+#endif //owner drawn
+ {
+ flagsOld |= MF_STRING;
+ data = strName;
+ }
+
+ if ( ::ModifyMenu(hMenu, id,
+ MF_BYCOMMAND | flagsOld,
+ id, data) == 0xFFFFFFFF )
+ {
+ wxLogLastError(T("ModifyMenu"));
+ }
+ }
+}