-
Enabling menu items
When I enable previously disabled/grayed menu item (I mean an item in the MAIN MENU BAR only) by calling EnableMenuItem, it will be still grayed, though enabled! Windows won't PAINT IT BLACK! I can force Windows to repaint the main menu bar by SetMenu(GetMenu(hwnd)) :). Does anybody know a better solution?
-
Enabling Menu Items
You can try this.....(using MFC) ON_UPDATE_COMMAND_UI
Code:
//////////////////////////////////////////////////////////
///in MainFrm.h
afx_msg void OnUpdateMyItem(CCmdUI* pCmdUI);
/////////////************************
////////////in MainFrm.cpp
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
.....OTHER MSGS
ON_UPDATE_COMMAND_UI(IDC_MYITEM, OnUpdateMyItem)
.......OTHER MSGS
END_MESSAGE_MAP()
...other funcitons
void CMainFrame::OnUpdateMyItem(CCmdUI * pCmdUI)
{
//** Specific to the item updated
//** each menu item requires its own OnUpdate.. function
//** see also ON_UPDATE_COMMAND_UI_RANGE
pCmdUI->Enable( bMyCondition == TRUE );
}
-