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 » Toolbar from icons Collapse All
Subject Author Date
Paul Cowan Jun 25, 2007 - 12:55 PM

Can I build a toolbar dynamically from a series of separate icons instead of one large bitmap? When built from icons, how can I change the size of the toolbar from 16X16 to 32X32 etc?

Paul Cowan Jul 4, 2007 - 12:43 PM

Thanks for the reply.

What is the easiest way of switching between different sized icons? I would like to have an option in the program to change all the toolbar buttons from 16X16 to 32X32. Can I have a .ico that has more then one size image and switch between them?

Technical Support Jul 5, 2007 - 4:02 AM

1) If your application is not customizable, reload all the command descriptions in the command manager, i.e. the command manager should be updated from the different toolbar/icon resources and finally you should re-compute the layout of the main frame/dialog and other windows.

2) If your application is customizable, the command tree nodes which represent toolbar buttons and menu items may contain icons of the of previous size, edited by the user so you should re-initialize the entire customization subsystem in the same way as it is done in the LanguageSwitcher sample where all the command texts should be reset after the preferred language changes.

Please let us know more details about your application so we can provide you with the exact steps.


Suhai Gyorgy Jul 5, 2007 - 1:27 AM

At any point, you can get a pointer to a particular command by its ID:

CExtCmdItem * pCmdItem =
	g_CmdManager->CmdGetPtr(
		strProfileName,
		nCmdId
		);
ASSERT (pCmdItem != NULL );
g_CmdManager->CmdSetIcon(
	strProfileName,
	pCmdItem->m_nCmdID,
	hIcon,
	false // Use the hIcon handle "as is"
);
Here hIcon can be either 16x16 or 32x32.

But keep in mind that changing the icon size for a command will change the icon size in the toolbars and in the menus as well. If you want to keep 16x16 icons in the menus all the time, follow this FAQ: How to use a small icon in menus and a large icon in toolbars for the same command?

Suhai Gyorgy Jun 26, 2007 - 1:46 AM

This FAQ can help: How to add buttons to toolbars dynamically?
The HICON used in that little sample code could also be 32x32 in size.
It can also be helpful if you check FunnyBars sample.