- if ( m_bChecked != bDoCheck ) {
- CheckMenuItem((HMENU)m_pParentMenu->GetHMenu(), m_idItem,
- MF_BYCOMMAND | (bDoCheck ? MF_CHECKED : MF_UNCHECKED));
+ m_strName = strName;
+
+ HMENU hMenu = GetHMenuOf(m_pParentMenu);
+
+ 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"));
+ }
+ }
+}