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 » Change popup menu item icon at run time Collapse All
Subject Author Date
Offer Har Aug 12, 2008 - 9:30 AM

Hi,


I have a popup menu which display icons next to the items in it. When the menu is displayed I need to chnage one of the icons according to some conditions in the code.


Can this be done? How?


Thanks,

Ron.

Technical Support Aug 12, 2008 - 1:49 PM

The popup menu uses icons stored in the command manager. The following code gets an icon object by command identifier:

UINT nCmdID = . . .
CExtCmdIcon * pIcon = g_CmdManager->CmdGetIconPtr( . . . , nCmdID );
      if( pIcon != NULL )
      {
            // this command has no icon, you can use one of the overloaded
            // CExtCmdManager::CmdSetIcon() methods for assign icon to this command
            return . . .
      }
The CExtCmdIcon::m_bmpNormal property of CExtBitmap type contains an icon’s image in 32-bit format with alpha channel. You can re-load this image, scale it out or apply visual effects using the methods of the CExtBitmap class.

The customizable menus are also based on the icons stored in the command manager. But the command items in customizable menus can display customized/edited version of icons which are stored in the command tree nodes.