Next Prev Up Top Contents Index

10.5.3.5 The Radio-Box and Check-Box Gadgets

A radio box is a special kind of gadget that constrains one or more toggle buttons. At any one time, only one of the buttons managed by the radio box may be "on." A radio box is responsible for laying out its contents (the buttons that it contains). So that the value of the radio box can be properly computed, it is a client of each of its buttons. As the current selection changes, the previously selected button and the newly selected button both have their value-changed-callback handlers invoked.

Like a radio box, a check box is a gadget that constrains a number of toggle buttons, but unlike a radio box, a check box may have zero or more of its buttons selected at a time.

radio-box

Summary: The class that implements a radio box. It is a subclass of value-gadget and oriented-gadget-mixin .

:current-selection

Summary: This is used to specify which button, if any, should be initially selected.

radio-box-current-selection [Generic Function]

Arguments: radio-box

(setf radio-box-current-selection) [Generic Function]

Arguments: button radio-box

Summary: Returns (or sets) the current selection for the radio box. The current selection will be one of the toggle buttons in the box.

radio-box-selections [Generic Function]

Arguments: radio-box

Summary: Returns a sequence of all the selections in the radio box. The elements of the sequence will be toggle buttons.

gadget-value [Generic Function]

Arguments: (button radio-box )

Summary: Returns the selected button (i.e., returns the same value as radio-box-current-selection).

radio-box-pane

Summary: The class that implements a portable radio box; it is a subclass of radio-box .

check-box

Summary: The class that implements a check box. check-box is a subclass of value-gadget and oriented-gadget-mixin .

:current-selection

Summary: This is used to specify which button, if any, should be initially selected.

check-box-current-selection [Generic Function]

Arguments: check-box

(setf check-box-current-selection) [Generic Function]

Arguments: button check-box

Summary: Returns (or sets) the current selection for the check box. The current selection will be a list of zero or more of the toggle buttons in the box.

check-box-selections [Generic Function]

Arguments: check-box

Summary: Returns a sequence of all the selections in the check box. The elements of the sequence will be toggle buttons.

gadget-value [Generic Function]

Arguments: (button check-box )

Summary: Returns the selected buttons as a list (i.e., returns the same value as check-box-current-selection).

check-box-pane

Summary: The class that implements a portable check box; it is a subclass of check-box .

with-radio-box [Macro]	

Arguments: ( &rest options &key (type one-of ) &allow-other-keys ) &body body

Summary: Creates a radio box whose buttons are created by the forms in body . The macro radio-box-current-selection can be wrapped around one of forms in body in order to indicate that that button is the current selection.

A radio box will be created if type is :one-of , a check box if :some-of .

For example, the following creates a radio box with three buttons in it, the second of which is initially selected.

           (with-radio-box () 
                           (make-pane 'toggle-button :label "Mono") 
                           (radio-box-current-selection 
                            (make-pane 'toggle-button :label "Stereo"))
                           (make-pane 'toggle-button :label "Quad")) 

The following simpler form can be used when you do not need to control the appearance of each button closely.

           (with-radio-box () "Mono" "Stereo" "Quad") 

CommonLisp Interface Manager 2.0 User's Guide - 8 Aug 2003

Next Prev Up Top Contents Index