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 » Dynamically load tool bar with the resources depending on the user selection Collapse All
Subject Author Date
howard liu Apr 30, 2008 - 2:35 PM

Hi,


What is the general procedure to dynamically load a tool bar, i.e. dynamically load different icons within a tool bar depending on the usage of the application. For Example, in my application I have three panes in the client area, (a) Graphics pane (b) text pane (c) result pane. These three panes share a common tool bar. But depending on the choice/selection of the panes by the user the toolbar gets updated with different tool bar icons. We tried the implementation of this by  LoadToolBar( IDR_TOOLBAR1/TOOLBAR2/TOOLBAR3). Whne we do this the tool bar resources (icons) disappear and reappears only when the tool bar is manually moved. 


 


Thanks 


Howard    

Technical Support May 1, 2008 - 1:41 AM

A toolbar in Prof-UIS is represented by the CExtToolControlBar<code> class and its buttons by <code>CExtBarButton. The latter implements a classic push button and a drop-down button. Besides you can attach any control or window to such a toolbar button object and this window will appear instead of the toolbar button. There are several additional CExtBarButton-derived classes which implement specific toolbar buttons (e.g. a slider button). But in general you should work with the methods and properties of CExtToolControlBar only.

The CExtToolControlBar::InsertButton() method allows you to insert a generic command button and CExtToolControlBar::InsertSpecButton() any toolbar button derived from CExtBarButton. The CExtToolControlBar::RemoveButton() method removes one button by its position. The CExtToolControlBar::CommandToIndex() method returns the button’s position by its command identifier. The CExtToolControlBar::SetButtons() and CExtToolControlBar::LoadToolBar() methods completely reinitializes all toolbar buttons.

Each toolbar button in a CExtToolControlBar stores only its command identifier. All the other information (an icon, tooltip text, status bar tip text and button text ) about the command (that is executed when you click on the button) are stored in a CExtCmdItem command description object stored in the command manager (the g_CmdManager global smart pointer variable which contains a pointer to the CExtCmdManager object). The CExtCmdManager::CmdGetPtr() method returns a pointer to a pre-allocated CExtCmdItem command description object. The CExtCmdManager::CmdAllocPtr() method allocates a new command description object and optionally allocates a new command identifier. So, you should allocate a command in the command manager before using it when calling CExtToolControlBar::InsertSpecButton(). This command manager-based architecture is essential and allows you to use the same command in menus and toolbars as in the classic Office UI.

You can learn more about this from :

Getting Started with Prof-UIS