Supply the selection-callback initarg to specify a callback for a toolbar button:
(setf print-button
(make-instance 'toolbar-button
:image :std-print
:text "Print File"
:selection-callback 'print-callback))
You can also supply selection-callback for a toolbar-component. This specifies the same callback function for each button in the component.
To specify different callback functions for each button in a toolbar-component, either make the buttons explicitly as above, or supply the callbacks initarg.
Where you want a toolbar button to perform the same command as a menu item, use the :remapped
initarg.
remapped
should match (by cl:equalp
) the
name
of the menu-item:
(display
(make-instance
'interface
:menu-bar-items
(list
(make-instance 'menu
:items
(list
(make-instance 'menu-item
:name 'say-hello
:data "Hello"
:callback
'test-callback))))
:toolbar-items
(list
(make-instance 'toolbar-button
:image :std-file-new
:remapped 'say-hello))))
You can, if desired, supply a
retract-callback
which is called when the button is deselected in a :multiple-selection
component. You can also make a button display a dropdown menu nearby. See Advanced toolbar features for the details.
CAPI User Guide and Reference Manual (Unix version) - 3 Aug 2017