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 » Different bitmaps in CExtMenuControlBar and CExtToolControlBar Collapse All
Subject Author Date
Emmanuel Verguet Sep 1, 2006 - 8:14 AM

Hello,

I’m using 24x24 bitmaps for my CExtToolControlBar. Entry menu with an ID common with my toolbar are 24x24 too. I have an another image list for my menu, which are 16x16 bitmaps. How can I use those bitmaps instead of toolbar ones ?

Thanks.

Technical Support Sep 3, 2006 - 1:16 PM

We follow the approach used in Microsoft Office applications, when there is only one icon per command. This icon is used both in toolbars and menus. You should use two different command identifiers if you want to see 16x16 icons in a menu and 24x24 icons in a toolbar. This restriction does not make development harder. For example, you have an ID_FILE_SAVE button in a toolbar based on 24x24 images and the main frame window handles this command:

ON_COMMAND( ID_FILE_SAVE, OnFileSave )
Now you can define and use a ID_FILE_SAVE_SMALL command in your menu resource. To connect this command to the CMainFrame::OnFileSave() handler method, you should manually add only one line to the message map:
ON_COMMAND( ID_FILE_SAVE_SMALL, OnFileSave )
Now you have two different commands which work like one command. The file save command in the toolbar displays a 24x24 icon. The file save command in the menu does not have an icon at all. To display the 16x16 icon in the menu, create a new toolbar resource with 16x16 images and define ID_FILE_SAVE_SMALL button in it. This toolbar resource will actually never be used in any toolbar window. We should simply put its icons into the command manager for making them accessible in menus. This should be done by invoking g_CmdManager->UpdateFromToolBar(...)during initialization (typically somewhere at the beginning of the CMainFrame::OnCreate() method).