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 » Application with 16x16 and 32x32 toolbars Collapse All
Subject Author Date
Simon DESEE Jun 27, 2006 - 6:18 AM

Hello all,

How can I use toolbars on my application with two different size (the user choose the size with options dialog) ?

I created toolbar resources for 16x16 and for 32x32 resources and I call g_CmdManager->UpdateFromToolBar for all toolbars.

But many assertion appears on the starting of the program.

Could you explain me more about how to do this ?

Technical Support Jun 28, 2006 - 7:28 AM

The solution depends on if the buttons in your two toolbar resources have equal resource identifiers. If they do but the images are different, you should update the command manager only from one of them at startup. To change the icons at run time, invoke g_CmdManager->CmdSetIcon( sProfileName, nCmdID, (CExtCmdIcon *) NULL, false ) for each command in your toolbar and then update the command manager from one of toolbar resources. This step is essential because the CExtCmdManager::UpdateFromToolBar() method does not replace icon commands.

If your two toolbar resources have buttons with absolutely different command identifiers, you should update the command manager from both toolbars at startup and construct the toolbar using the CExtToolControlBar::SetButtons() method (pass an array of command identifiers in it) instead of CExtToolControlBar::LoadToolbar(). The toolbar will contain both small and large buttons. You can apply the TBBS_HIDDEN style for some of them to make only half of buttons visible.

In both cases, do not forget to call the pToolBar->GetParentFrame()->RecalcLayout() code when the toolbar has been changed.

Simon DESEE Jul 1, 2006 - 8:45 AM

Ok, with customization activate, how does your library manage the state information file (my application stores state information on a file instead of using registry) ?

Is it a difference between 16x16 and 32x32 toolbars ID on the file ?

Thanks

Technical Support Jul 3, 2006 - 10:17 AM

The StateInFile, SDIDynamicBars and MDIDynamicBars samples demonstrate how control bars can be serialized to a file. Basically the state of any sub system is serialized with the CArchive object. If the archive is file-based, the state will be saved to/restored from a file. The registry serialization is based on a archive connected to a memory file. The contents of the memory file is saved to / loaded from registry sub trees.

Simon DESEE Jun 28, 2006 - 3:29 PM

My two toolbars have same identifiers.

I adjust my code.

Thanks for your help