1 CAPI Reference Entries

button-panel

Class

Summary

The classbutton-panel is a pane containing a number of buttons that are laid out in a particular style, and that have group behavior.

Superclasses

choice
titled-pane

Subclasses

push-button-panel
radio-button-panel
check-button-panel

Slots

layout-class
The type of layout for the buttons.

layout-args
Initialization arguments for the layout.

callbacks
The selection callbacks for each button.

Description

The classbutton-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.

The subclassespush-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).

The layout of the buttons is controlled by a layout of classlayout-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.

Each button uses the callbacks specified for the button panel itself, unless the argumentcallbacks is specified. This should be a list of callbacks (one per button) which if non-nil will be used for theselection-callback.

Compatibility Note

Button panels now default to having a maximum size constrained to their minimum size as this is useful when attempting to layout button panels into arbitrary spaces without them changing size. To get the old behavior, specify:max-width nil in themake-instance.

Example

(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)))

Example File

capi/elements/buttons.lisp

See Also

radio-button
check-button
push-button
set-button-panel-enabled-items


CAPI Reference Manual, Liquid Common Lisp Version 5.0 - 3 OCT 1997

Generated with Harlequin WebMaker