|
-
June 18th, 2008, 11:07 PM
#1
Disabling::Popup Menu
Code:
IDR_MYMENU MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", ID_FILE_EXIT
END
POPUP "&Stuff"
BEGIN
MENUITEM "&Go", ID_STUFF_GO
MENUITEM "G&o somewhere else", 0, GRAYED
END
END
I have the menu above. I can disable each item in the popup based on the ID but I can't grayout the the main popup area. In this case the &File.
Is their a way to disable it, without knowing its ID?
-
June 18th, 2008, 11:36 PM
#2
Re: Disabling::Popup Menu
-
June 19th, 2008, 12:14 AM
#3
Re: Disabling::Popup Menu
@shekar: already check that, but not what Im looking for.
-
June 19th, 2008, 04:03 AM
#4
Re: Disabling::Popup Menu
Something like:
Code:
CMenu* pMenu = AfxGetMainWnd()->GetMenu();
if(pMenu != NULL)
pMenu->EnableMenuItem(1, MF_BYPOSITION | MF_GRAYED); // disable second (with index '1') menu
Victor Nijegorodov
-
June 19th, 2008, 04:55 AM
#5
Re: Disabling::Popup Menu
And please don't miss this point:
From MSDN
When you change a window menu, the menu bar is not immediately updated. To force the update, call DrawMenuBar.
Best regards,
Igor
-
June 19th, 2008, 05:04 AM
#6
Re: Disabling::Popup Menu
Good point, Igor!
(Although in my small and fast test the menu item was disabled without DrawMenuBar call, it is still required if some of menus/submenus was removed or added or the whole menu bar).
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|