MFC menus

Started by
5 comments, last by CProgrammer 20 years, 2 months ago
How can I make a menu item not clickable according to a boolean, so if the boolean is true one can click the menu objekt, otherwise not. -CProgrammer
Advertisement
Did you try CMenu::EnableMenuItem() ?
The Menu is set in the CSingleDocTemplate. So will that still work?
-CProgrammer
Oh I think I got it with EnableMenuItem, thanks.
Hmm I tried:
GetMenu()->EnableMenuItem(ID_FILE_NEW, MF_GRAYED);
But it doesnt work?
-CProgrammer

Try:

GetMenu()->GetSubMenu(0)->EnableMenuItem(ID_FILE_NEW, MF_GRAYED);

Assuming it is the first popup menu (index 0) ID_FILE_NEW is located in which I believe it is

/Cheers
No doesnt work, but I just found an alternative in one of my books:
On_update_command_ui
-CProgrammer

This topic is closed to new replies.

Advertisement