Remember that each instance of a toolbar button must not be used in more than one place at a time.

It is possible to include to include toolbar buttons which are not initially displayed, but which are available for the user to add. For the details, see Modifying toolbars.

9.2.1 Grouping toolbar buttons

The toolbar-component class lets you group related buttons together in a toolbar. This allows similar buttons to:

Share properties such as callbacks.

Be visually separated from other buttons in the toolbar.

On Microsoft Windows, form a separately dockable group of items.

Toolbar components are actually choices similar to button panels. By default, their
interaction
is :single-selection.

We can amend our example using toolbar components to group the file buttons separately from the print button:

(display

(make-instance

'interface

:toolbar-items (list

(make-instance 'toolbar-component

:items file-buttons)

(make-instance 'toolbar-component

:items (list print-button)))

:visible-min-width 200))

9.2.2 Implicitly-created buttons

A toolbar-component may contain arbitrary Lisp objects as items. For each such object, a toolbar button is automatically created, using the appropriate elements of the component's
images
,
names
,
texts
and
tooltips
lists.

(display

(make-instance

'interface

:toolbar-items

(list (make-instance 'toolbar-component

:items file-images

:images file-images

:names file-images

:texts

(mapcar 'string-capitalize file-images)

:tooltips

(mapcar 'string-downcase file-images)

:selection-callback

(lambda (data interface)

(display-message "callback data ~S" data))

))))

Rather than
selection-callback
above, you could supply
callbacks
to specify callback functions for each button.