radio-button

Class

Package: common-graphics

Class

The class of a radio-button control.

Control

An instance of the :radio-button class. This is a standard radio button control. The title field of the dialog item is used as the name of the radio button, and is displayed immediately to the right of the radio button itself. The value field of the dialog item is set to t if the radio button is on and is set to nil if it is off.

The behavior of radio buttons is to select one item in the cluster to the exclusion of all others. You are not required to place a group box around the set. Radio buttons are defined as being in a particular group via the :cluster property.

Adding a radio-button control to your form

Click the radio-button tool on the Component toolbar. Move the mouse cursor to the part of the form where you want to place the control, and click again. The control will appear with colored resizing handles.

Resizing and moving the control

Controls can only be resized and moved on forms during the design stage; the size and location of everything is fixed on a running form.

Resize the control by clicking the mouse cursor and dragging one of the handles to the new size-point. Release the mouse key when you are satisfied with the new size. Note: resizing the radio-button control changes the size of the bounding-box, but not the size of the actual radio button inside.

Move the control by clicking anywhere on it except a resizing handle and dragging it to a new location on the form. Release the mouse key when you are ready to place the control.

Grouping radio-buttons together

The :cluster entry on the dialog item plist is used to group radio button dialog items into clusters. If the user clicks on one button in the cluster, that button will be turned on, and all other buttons in the cluster turned off. For example, consider the following:

(make-instance 'radio-button ... :cluster 'cluster1) 
(make-instance 'radio-button ... :cluster 'cluster1) 
(make-instance 'radio-button ... :cluster 'cluster2) 
(make-instance 'radio-button ... :cluster 'cluster2)

It creates two radio button clusters with two radio buttons each. :cluster entries are compared using eql.

Using click-off with radio-button controls

Radio-button supports the click-off property. The :click-off property can have the following values:

:no: Users can only deselect a selected button by selecting another button in the same cluster.

:yes: Users will be able to deselect the button by clicking on it when currently selected.

nil: The default value for the specific class of control.

Note: this option affects only what happens when clicking on a button widget while it is in focus; the state of the button can always be changed programmatically with value.

See About how to get sample code for creating controls in cgide.htm, which explains how to use the IDE to create such code.

Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.