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 Tech Support » equivalent in ProfUI for EnableMenuItem ( ) in prof-UI ? Collapse All
Subject Author Date
howard liu Aug 19, 2008 - 8:28 AM

Hi,


In a popup menu using CExtPopupMenuwnd we are modifying popup menu and within that menu item we are enabling and disabling certain items using EnableMenuItem( ) method in MFC. Is there a equivalent for EnableMenuItem( ) method in Prof-UI. 


If not how to achieve this functionality  in Prof-UI


Thanks


Howard  

Technical Support Aug 19, 2008 - 11:54 AM

There are two types of menu command items in a Prof-UIS popup menu:

1) Menu command items which are based on MFC’s command updating mechanism. Such command items are inserted using the CExtPopupMenuWnd::ItemInsert() method.

2) Menu command items which are NOT based on MFC’s command updating mechanism. Such command items are inserted using the CExtPopupMenuWnd::ItemInsertCommand() method.

By default, all the command items in a popup menu are based on the command manager and you should use MFC’s command updating mechanism for enabling/disabling menu command items and for setting on/off their check or radio marks. You should add the command updating methods for all the menu commands by default.

The CExtPopupMenuWnd::LoadMenu() and CExtPopupMenuWnd::UpdateFromMenu() methods also initialize popup menus with menu command items which are based on MFC’s command updating mechanism. If you invoke these methods and specify false() in the bNoRefToCmdMngr parameter, all the menu command items in the initialized menu tree will not be based on MFC’s command updating mechanism. The same happens when you are using the CExtPopupMenuWnd::ItemInsertCommand() method. Such command items in popup menus should be enabled/disabled manually:

CExtPopupMenuWnd * pPopup = . . .
UINT nCmdID = . . .
bool bEnable = . . .
UINT nIndex = pPopup->ItemFindPosForCmdID( nCmdID );
      if( nIndex < 0 )
            return . . .
CExtPopupMenuWnd::MENUITEMDATA & _mii = pPopup->ItemGetInfo( nIndex );
      _mii.Enable( bEnable );