|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Stephan Finkler
|
May 2, 2005 - 5:21 AM
|
Hi,
how can I disable/enable a popup menu in a menu?
1) In OnExtMenuPrepare I tried
INT Pos = pPopup->ItemFindByText(_T("My_PopupMenuItem")); if(Pos != -1) { CExtPopupMenuWnd::MENUITEMDATA & _md = pPopup->ItemGetInfo( Pos ); _md.Enable(false); }
but it does not work. It only works for MenuItems with Cmds.
By the way, I don’t like to find the item by text. Is it possible to get the pos by ItemFindPosForCmdID.
2) Nice would be to handle that in an on_update_command_ui.
Thanks for your help
|
|
Technical Support
|
May 3, 2005 - 8:38 AM
|
The pop-up submenu items cannot be optionally disabled and we cannot make use MFC’s command updating mechanism because in this case all Prof-UIS users would have to add command updating handlers for all pop-up submenu items. In non-customizable applications pop-up submenu items have no command identifiers at all, i.e. their command identifiers are equal to -1 that indicates this menu item type is a pop-up submenu. So, you cannot lookup/find pop-up submenu items by their command identifiers in this case. In case of customizable applications pop-up submenu items are based on command tree nodes of the Prof-UIS customization subsystem called "customize site". The command identifiers of the command tree nodes corresponding to the pop-up submenu items can be generated by your code if you construct command trees manually. In fact, in 99.9999% cases the command identifiers OF pop-up command tree nodes for pop-up submenu menu items are generated on-the-fly automatically by Prof-UIS framework when loading menu resources. As you know, pop-up submenu items in Win32 menu resources have no unique command identifiers at all. So, finding pop-up submenu items in customizable applications by their command identifiers is possible but a bit complicated and inconvenient. In any case, before you are able to disable pop-up sub-menu items, we will need to find a way for smooth and safe integration of your task with MFC’s command updating mechanism.
|
|