All Manuals > CAPI User Guide and Reference Manual > 9 Adding Toolbars

9.7 Advanced toolbar features

9.7.1 Toolbar items other than buttons with images

A toolbar-component, a toolbar or the interface toolbar may also contain CAPI panes as items, which will appear within the toolbar. This is typically used with text-input-pane, option-pane, and text-input-choice. Each pane should have toolbar-title (see simple-pane) specified, to provide the text that is shown for the toolbar item:

(display
 (make-instance
  'interface
  :toolbar-items (list
                  (make-instance 'toolbar-component
                                 :items (list print-button))
                  (make-instance 'text-input-pane
                                 :text "Text Input Pane"
                                 :visible-min-width :text-width
                                 :toolbar-title "Text Input Pane")
                  (make-instance 'text-input-choice
                                 :items
                                 (list "Text Input Choice1"
                                       "Text Input Choice2")
                                 :visible-min-width :text-width
                                 :toolbar-title "Text Input Choice")
                  (make-instance 'option-pane
                                 :items
                                 (list "Option Pane1"
                                       "Option Pane2")
                                 :visible-min-width :text-width 
                                 :toolbar-title "Option Pane")
                  )
  :visible-min-width 500))

Note: Some platforms may not recommend placing text input panes and so on in a toolbar. You may wish to consult the appropriate user interface guidelines before adding such a toolbar in your application.

Note: Each toolbar-button or simple-pane in the toolbar-items list (including those within a toolbar-component) should have a name that is not cl:eql to any other item in the list. These names are needed to support :items in interface-toolbar-state and the :toolbar-states initarg.

Toolbar buttons can display text, which should be in the data or text slot inherited from item. You can specify whether text and/or image is displayed, using :display in the toolbar-states initarg or interface-toolbar-state.

9.7.2 Alternative interaction in a toolbar

You can make a toolbar-component with interaction :multiple-selection and then each of its buttons may have a retract-callback which is called when the user clicks a selected button to deselect it.

9.7.3 Toolbar buttons with menus

You can add a menu to a toolbar button, which is displayed via a separate smaller button next to the main button. To do this, supply dropdown-menu or dropdown-menu-function. See toolbar-button for the details.


CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:21