Class
button-panel is a pane containing a number of buttons that are laid out in a particular style, and that have group behavior. button-panel inherits most of its behavior fromchoice, which is an abstract class providing support for handling items and selections. By default, a button panel is single selection (meaning that only one of the buttons can be selected at any one time), but this can be changed by specifying an interaction. push-button-panel,radio-button-panel andcheck-button-panel are provided as convenience classes, but they are just button panels with different interactions (:no-selection,:single-selection and:multiple-selection respectively). layout-class (which defaults torow-layout) but this can be changed to be any other CAPI layout. When the layout is created, the list of keyword argumentslayout-args is passed to themake-instance. callbacks is specified. This should be a list of callbacks (one per button) which if non-nil will be used for theselection-callback. button-panel and its subclasses, the items supplied to the:itemsinitarg and(setf collection-items) function can contain button objects. In this case, the button is used directly in the button panel rather than a button being created by the CAPI. button-panel being used, as shown in the following table: Button panel class | Button class |
|---|---|
push-button-panel | push-button |
| radio-button-panel | radio-button |
| check-button-panel | check-button |
(let ((button1 (make-instance 'capi:push-button
:text "button1"
:internal-border 20
:min-width 200))
(button2 (make-instance 'capi:push-button
:text "button2"
:internal-border 20
:min-width 200)))
(capi:contain (make-instance 'capi:push-button-panel
:items (list button1 button2)
:layout-args '(:x-gap 30))))
:max-width nil in themake-instance.
(capi:contain (make-instance
'capi:button-panel
:items '(:red :green :blue)
:print-function 'string-capitalize))
(setq buttons (capi:contain
(make-instance
'capi:button-panel
:items '(:red :green :blue)
:print-function 'string-capitalize
:interaction :multiple-selection)))
(setf (capi:choice-selected-items buttons)
'(:red :green))
(capi:contain (make-instance
'capi:button-panel
:items '(1 2 3 4 5 6 7 8 9)
:layout-class 'capi:grid-layout
:layout-args '(:columns 3)))