ClassPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version

check-box

Class

The class of the check-box control.

Control

Instance of the check-box class. This is a standard check-box control. A check-box is a control which permits two of three states (depending on the value of the three-state property).

A two-state check-box is either toggled on or off by clicking it. When it is on, the value field of the dialog item is set to t and the box is filled with a check mark. When it is off, the value field of the dialog item is set to nil and the box is blank.

A three-state check-box will show a third grayed-out state when its value is :gray. This intermediate state is typically used either to indicate that a true-or-false value is unknown or undetermined, or that some but not all of a set of subchoices are selected. Clicking on or otherwise selecting the check-box will cycle its value between nil, t, and :gray (in that order). The value can also be :except-interactively, which allows :gray to be specified programmatically but not by clicking it or by pressing the spacebar when it has the keyboard focus.

You can have as many check-boxes on a dialog as you wish. Each one works independently of the others; that is, they aren't defined in groups via the :cluster property as radio-buttons are.

The title field of the dialog item is used as the label of the check-box, and is displayed immediately to the right of the check-box itself. The title will wrap or not as the wrapping property is true or nil.

Adding a check-box control to your form

Click the check-box 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 check-box control changes the size of the bounding-box, but not the size of the actual check-box inside. Resize the label for the box by changing the font property.

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.

Creating an instance of a check-box control

This call to make-instance returns an instance of a check-box. Properties can be initialization keyword arguments (the keyword has the same name as the property, with a prepended colon, e.g. :left for left). Additional arguments could be provided. Their absence indicates the default value will be used.

(make-instance 'check-box
                :font
                 (make-font-ex nil "MS Sans Serif" 11 nil)
                :left 242
                :three-state nil ;; a two-state check-box
                                 ;; specify t for a three-state
                                 ;; check-box. Note that the three-state
                                 ;; property cannot be changed after
                                 ;; a check box is created.
                :name :check-box-1
                :title "Check Box"
                :top 180)

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

A diagram of window and widget classes is shown in Widget and window classes in cgide.htm.


Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 9.0 page.
Created 2015.5.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version