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 » Menu Icon 16x16 and ToolBar Icon 32x32 Collapse All
Subject Author Date
Christan HIRIGOYEN Jan 4, 2006 - 3:51 AM

How can I force the menu to use the icon 16x16.


I have 2 toolbars one 16x16 for the menu and one 32x32 for the application.


the flag CExtPopupMenuWnd::g_bMenuLargeIcons = false; has no effect.


is there a way to do this as the CmdManager handle only one icon for one ID ?


Thanks for any help.

Technical Support Jan 4, 2006 - 11:37 AM

In fact, the command manager supports only one icon for each command object. So, you need to use two command identifiers to make the same command having different icons in toolbars and in menus. This is not difficult. Let us assume you have defined ID_MY_COMMAND_SMALL in a menu and ID_MY_COMMAND_LARGE in a toolbar. After that you can add command handling and updating methods for the ID_MY_COMMAND_SMALL command using the Visual Studio wizard. Finally, add similar message map lines with the same method names but with the ID_MY_COMMAND_LARGE command identifier. The following will be added by Visual Studio:

afx_msg void OnMyCommandSmall();
afx_msg void OnUpdateMyCommandSmall( CCmdUI * pCmdUI );
ON_COMMAND( ID_MY_COMMAND_SMALL, OnMyCommandSmall )
ON_UPDATE_COMMAND_UI( ID_MY_COMMAND_SMALL, OnUpdateMyCommandSmall )
void CMainFrame::OnMyCommandSmall()
{
}
void CMainFrame::OnUpdateMyCommandSmall( CCmdUI * pCmdUI )
{
}
Please add the following to the message map manually:
ON_COMMAND( ID_MY_COMMAND_LARGE, OnMyCommandSmall )
ON_UPDATE_COMMAND_UI( ID_MY_COMMAND_LARGE, OnUpdateMyCommandSmall )
This will make the ID_MY_COMMAND_LARGE and ID_MY_COMMAND_SMALL commands working like a single command.