Can't get a menu item to gray
Gauging by my questions, it should be apparent that I'm somewhat of a
In an SDI app, I have menu commands with associated toolbar buttons
that refuse to gray. I retrieve the menu from the m_pMainWnd pointer
and it is valid because checking menu items works. Graying them,
however, seems to have no effect. What am I missing?
The basic method I use is:
menu->EnableMenuItem( ID_MENU_ITEM, MF_BYCOMMAND | ( X ? MF_ENABLED :
MF_GRAYED ) );
....where X, of course, yields a boolean result.
Does this have something to do with the toolbar or the SDI framework?
Re: Can't get a menu item to gray
try setting m_bAutoMenuEnable = false ; in your CMainFrame
constructor. Otherwise - which is default - you have to use
ON_UPDATE_COMMAND_UI handlers for changing states of menu items, because the
menu-popup-windows were built just before they were displayed.