Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS General Discussion » CExtPopupMenuWnd::ItemEnabledSet Collapse All
Subject Author Date
Mac Will Dec 6, 2005 - 1:18 PM


Hello,


I am trying to disable a popup menu item.  I am wondering why the itemboldset works but i can’t get ItemEnabledSet to work?


 


Here is my code:


CExtPopupMenuWnd * pSUBPopup = new CExtPopupMenuWnd();


 pPopup->ItemInsertSpecPopup(


 pSUBPopup,


 3,


 _T( "Zoom" )


 );


 pPopup->ItemBoldSet(3,true);

Corey Paneque Jan 16, 2024 - 3:41 AM

This script is visually descriptive, allowing me to easily imagine the setting and action. The pacing is perfect, with moments of both tension and humor.
https://snaptiktake.com/

Mac Will Dec 7, 2005 - 6:54 AM


So in theory this should have worked?


CExtPopupMenuWnd::MENUITEMDATA & mi = pPopup->ItemGetInfo(1);


mi.SetNoCmdUI(false);


pPopup->ItemEnabledSet(1,false);


 


Unfortunately it did not work???

Mac Will Dec 6, 2005 - 1:21 PM

PS:  I am using the FULL VERSION of prof-UIS 2.50

Mac Will Dec 6, 2005 - 1:20 PM

Sorry about that I don’t know what happened:


 


To finish what I was saying:


 


pPopup->ItemBoldSet(3,true); //works fine


but


pPopup->ItemEnabledSet(3,false); //doesn’t disable the item?


 


Thanks!!

Technical Support Dec 7, 2005 - 9:49 AM

Please email us your project or a test application so we can find out what’s wrong.

Technical Support Dec 7, 2005 - 2:07 AM

It’s simple. By default the command items in popup menus are controlled by MFC’s command updating mechanism. This works both in menu bar’s menus and in context menus. So, your command is enabled because its command handler is defined or because its command updating handler enables it via CCmdUI::Enable() method. It is possible to use Prof-UIS popup menus without MFC’s command updating mechanism. Please take a look at the CExtPopupMenuWnd::LoadMenu() and CExtPopupMenuWnd::UpdateFromMenu() method declarations. Their last parameter is the bNoRefToCmdMngr flag. If you set it to true, then the command updating mechanism will not be used and you will have to enable/disable menu items manually as you tried to do. It is also possible to turn off the command manager using for particular command items in the menu. Get a reference to the CExtPopupMenuWnd::MENUITEMDATA object which describes the menu item. This can be done by invoking the CExtPopupMenuWnd::ItemGetInfo() method. Then you need to invoke the CExtPopupMenuWnd::MENUITEMDATA::SetNoCmdUI() method and specify false for its parameter. The popup menus that do not use the command updating mechanism are needed only when you build menu items dynamically. In other cases, this mechanism is very convenient. Besides, it automatically updates the states of both menu items and toolbar buttons.