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 9.7 Advanced toolbar features for the details.
CAPI User Guide and Reference Manual (Macintosh version) - 01 Dec 2021 19:31:21