Working with IToolBarButton Parts

The following tasks are associated with using an IToolBarButton* part in visual composition. Tasks that are common to many parts are described in related topics.

Assigning a bitmap
To assign a bitmap to the tool bar button, set the resourceId property in the IToolBarButton* property sheet. In the Resource Id prompter property window, specify a bitmap resource by setting the following fields:

Setting the initial view of a tool bar button
Tool bar buttons can show bitmaps, text, or both. If the tool bar button is on a tool bar, the tool bar styles determine the view of the button. Otherwise, tool bar button styles determine the view. To define the initial view of a tool bar button that is not on a tool bar, do either of the following:

Grouping buttons on a tool bar
To visually separate a set of tool bar buttons from adjacent controls on a tool bar, define the buttons as a control group. This procedure is described in a related topic as a common task for controls.

Enabling button latching
To enable latching the button down when it is pressed, open the style property in the IToolBarButton* property sheet and set the latchable style to on.

Enabling automatic latching for a group of buttons
If you define a set of tool bar buttons as a control group, you can enable automatic latching for the buttons. Then, when one button in the group is selected and latched, the currently latched button in the group is unlatched. To enable automatic latching for each button, open the style property in its property sheet and set the autoLatch style to on.

Calling an action from a button
To start the action represented by the button, connect the IToolBarButton* buttonClickEvent feature to the action on the target part.


Related procedures
Common Tasks for Control Parts
Setting Part Style Properties
Setting Part Color Properties
Setting Part Font Properties
Setting Part Handlers Properties
Setting Part Framing Properties
Providing Drag and Drop Support
Working with VisualAge User Interface Parts

Related references
IToolBarButton
Property Settings -- IToolBarButton
Portability -- IToolBarButton