EnableMenuItem does not work
-
I have an application with a menu that I want to disable one command in it. I write:
CMenu *pmenu; pmenu=CMaimFrame::GetMenu(); pMenu->EnableMenuItem (ID_FILE_OPEN,MF_BYCOMMAND|MF_GRAYED);
But the item will not go gray !!! Shay -
I have an application with a menu that I want to disable one command in it. I write:
CMenu *pmenu; pmenu=CMaimFrame::GetMenu(); pMenu->EnableMenuItem (ID_FILE_OPEN,MF_BYCOMMAND|MF_GRAYED);
But the item will not go gray !!! Shay -
Include MF_DISABLED. See if that does it. EnableMenuItem (ID_FILE_OPEN, MF_BYPOSITION|MF_DISABLED|MF_GRAYED) Kuphryn
Not working. I have a strange feeling that it's not pointing to my menu, If I type
CMeny *pmenu=GetMenu(); pmenu->DestroyMenu();
Nothing happened ..... -
I have an application with a menu that I want to disable one command in it. I write:
CMenu *pmenu; pmenu=CMaimFrame::GetMenu(); pMenu->EnableMenuItem (ID_FILE_OPEN,MF_BYCOMMAND|MF_GRAYED);
But the item will not go gray !!! ShaySince you're using an MFC app, you should probably be using command update handlers to deal with enabling/disabling menu items. See Mike Dunn's C++ FAQ section 7.1[^] for more information.
"We are the knights who say Ni" (The Knights Who Say Ni)