[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

Checkboxes (CHECKBOX_KIND) are appropriate for presenting options which
may be turned on or off.  This kind of gadget consists of a raised box
which contains a checkmark if the option is selected or is blank if the
option is not selected.  Clicking on the box toggles the state of the
checkbox.

The width and height of a checkbox are currently fixed (to 26x11). If
variable-sized checkboxes are added in the future,  they will be done in a
compatible manner.  Currently the width and height specified in the
NewGadget structure are ignored.

The checkbox may be controlled with the following tags:

GTCB_Checked (BOOL)
    Set this attribute to TRUE to set the gadget's state to checked.  Set
    it to FALSE to mark the gadget as unchecked.  The default is FALSE.
    (Create and set.)

GA_Disabled (BOOL)
    Set this attribute to TRUE to disable the checkbox, to FALSE
    otherwise.  The default is FALSE.  (Create and set.)

When the user selects a checkbox, the program will receive an IntuiMessage
with a class of IDCMP_GADGETUP.  As this gadget always toggles, the
program can easily track the state of the gadget.  Feel free to read the
Gadget->Flags GFLG_SELECTED bit.  Note, however, that the Gadget structure
itself is not synchronized to the IntuiMessages received.  If the user
clicks a second time, the GFLG_SELECTED bit can toggle again before the
program gets a chance to read it.  This is true of any of the dynamic
fields of the Gadget structure, and is worth being aware of, although only
rarely will an application have to account for it.