Adding a Toolbar
iTool toolbars are created using the CW_ITTOOLBAR compound widget. The signature of the CW_ITTOOLBAR function is:
Result = CW_ITTOOLBAR(Parent, UI, Target [, KEYWORDS])
where:
- Parent is the widget ID of the base widget on which the toolbar will be displayed.
- UI is the user interface object associated with the interface.
- Target is the iTool identifier, relative to the iTool associated with UI, of the container whose operations or manipulators should be included in the toolbar.
- KEYWORDS are keywords either handled explicitly by the widget, or passed through to the widgets that make up the compound widget.
Standard Toolbars
Operations registered in the iTool containers that create the standard toolbars are automatically sensitized and desensitized to reflect whether the corresponding operation or manipulator is currently available. Some items are sensitized when the selected item is of the correct data or visualization type, others (such as Undo and Redo) are sensitized when some other criteria are met. Still others (such as the File Open operation) are always available.
The following statements create the toolbars used by the standard iTools:
wToolbar = WIDGET_BASE(wBase, /ROW, XPAD=0, YPAD=0, SPACE=7) wTool1 = CW_ITTOOLBAR(wToolbar, oUI, 'Toolbar/File') wTool2 = CW_ITTOOLBAR(wToolbar, oUI, 'Toolbar/Edit') wTool3 = CW_ITTOOLBAR(wToolbar, oUI, 'Manipulators', /EXCLUSIVE) wTool4 = CW_ITTOOLBAR(wToolbar, oUI, 'Manipulators/View',$ /EXCLUSIVE) wTool5 = CW_ITTOOLBAR(wToolbar, oUI, 'Toolbar/View') wTool6 = CW_ITTOOLBAR(wToolbar, oUI, 'Manipulators/Annotation', $ /EXCLUSIVE)
There are a couple of points to note:
- Some of the standard operations displayed as toolbar buttons are proxies to operations that are registered in other containers. For example, the
Toolbar/Filecontainer contains proxies to four of the operations registered in theOperations/Filecontainer:New,Open,Save, andPrint. Proxies are described in Registering Components. - The EXCLUSIVE keyword is passed through the CW_ITTOOLBAR function to the underlying widget base via the keyword inheritance mechanism. See the description under WIDGET_BASE for details.
Modifying Toolbar Contents
Each iTool toolbar contains an entry for each item that is registered in the container. This has two ramifications:
- If you register (or proxy) a new operation or manipulator in one of the standard toolbar containers, it will appear on the toolbar for your iTool, and be sensitized and desensitized according to the same rules as the other items.
- If you unregister an operation or manipulator from one of the standard toolbar containers, it will be removed from the toolbar for your iTool.
Operations and manipulators are generally registered and unregistered in the Init method of an iTool creation routine. See Creating an Operation or Creating a Manipulator for details. For an example that shows how to unregister standard toolbar items, see Example: a Custom iTool Interface.
Resizing Toolbars
Toolbars consist of bitmap buttons that cannot be resized, so no special resizing code is required. If you are concerned that all of your toolbars appear even if the user resizes the top level base widget to a width too narrow to display them all, you can either set a minimum width for the top level base or write resizing code that arranges the toolbars into multiple rows if the top level base is not wide enough.