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

9.3 Specifying the image for a toolbar button

There are several ways to supply the image for a toolbar button, including direct specification of an image object. The simplest approach is to use a symbol which is registered as an image identifier, including the pre-registered standard images, as in the preceding examples. For details of this and the other way to supply images, see toolbar-button.

You can, if desired, supply an alternative image which is displayed while the button is selected in a :multiple-selection component (see 9.7 Advanced toolbar features), using the initarg selected-image.

9.3.1 Specifying images for a group of toolbar buttons

In a toolbar-component it is possible to specify images for the buttons by supplying an image-set as the default-image-set, along with integers in the images initarg specifying the index for the image of each button:

(display
 (make-instance
  'interface
  :toolbar-items
  (list
   (make-instance
    'toolbar-component
    :items '(1 2) :names '(1 2) :texts '("One" "Two")
    :images '(0 1)
    :default-image-set
    (make-general-image-set
     :image-count 5
     :id 
     (gp:read-external-image
      (example-file
       "capi/elements/images/toolbar-radio-images.bmp")
      :transparent-color-index 7))))))

CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:33:51