Check Box

From BR Wiki
Revision as of 17:19, 23 July 2013 by Laura (talk | contribs)
Jump to navigation Jump to search

The Business Rules! Check Box or checkbox widget allows the users to choose a binary option. Checked or Not-Checked.

Specify "row, col, CHECK cols [,Attributes] [,Fkey] [,NOWAIT]": "[^]caption"

These work like Radio Buttons, except they are not functionally grouped. In both control types, INPUT FIELDS reads checked or unchecked captions.

Check boxes can function with PRINT, INPUT, and RINPUT operations (the above syntax only shows one RINPUT FIELDS example). Each works a bit differently: PRINT FIELDS will print the label and box but not allow selection; INPUT FIELD will print the box for selection but not the label (and so needs a different PRINT FIELDS statement for a label; and RINPUT FIELDS displays both the box and the label and allows a selection to be made.

The parameters are as follows:

Row and col determine where the buttons will be.

CHECK means its a check box.

Cols is the width of the displayed caption.

Any Screen Attribute can be used here, following a comma. This is optional.

If FKEY is specified, an FKEY interrupt is generated when the item is clicked ON or OFF.

NOWAIT denotes the G attribute, which returns control immediately to the program.

The carrot (^) at the beginning of the caption indicates an ON (checked) setting. The carrot is not displayed but is used within files to determine the status of the information in the check box.

In order for the operator to have time to select something within a checkbox, a DO LOOP is often used, as you can see in the following example.

Example

In the following example, two 8-column checkboxes are created. The loop keeps executing until Esc is pressed. Both checkboxes may be checked simultaneously. The appropriate FKey value is printed any time either of the checkboxes is checked or unchecked.

00100 let X$="one" : let Y$="two"
00200 PRINT FIELDS "5,1,C 20": "Press Esc to quit"
00300 do
00400    RINPUT FIELDS "1,1,CHECK 8,,10;2,1,CHECK 8,,11": X$,Y$
00500    PRINT FIELDS "4,1,N 2": FKEY
00600 loop WHILE FKEY~=99

Output