Cicode Programming Reference > Cicode Function Categories > Form Functions Introduction > FormCheckBox

FormCheckBox

Adds a check box to the current form. The check box is a form control that allows the operator to make individual selections. Each check box can be either checked (true) or cleared (false).

You should call this function only after the FormNew() function and before the FormRead() function. The check box is added to the form at the specified column and row position. The width of the button is automatically sized to suit the text.

Syntax

FormCheckBox(Col, Row, sText, sBuf)

Col:

The number of the column in which the check box will be placed. Enter a number from 0 (column 1) to the form width - 1. For example, to place the check box in column 8, enter 7.

Row:

The number of the row in which the check box will be placed. Enter a number from 0 (row 1) to the form height - 1. For example, to place the check box in row 6, enter 5.

sText:

The text associated with the check box.

sBuf:

The string buffer in which to put the state of the check box. You should initialize this buffer to the state of the check box. When the form returns, this buffer will contain either '1' or '0' if the box is checked.

Return Value

The field handle if the check box is successfully added, otherwise -1 is returned.

Related Functions

FormNew, FormRead

Example

! Create a form, add check boxes, and display the form.
! The operator may select none or all of the check boxes.
FUNCTION FnMenu()
STRING sNuts, sCherrys, sChocolate;
sNuts = "1";
sCherrys = "0";
sChocolate = "1";
FormNew("IceCream",20,6,1); ]
FormCheckBox(2 ,2,"Nuts", sNuts);
FormCheckBox(2, 3,"Cherrys", sCherrys);
FormCheckBox(2 ,4,"Chocolate", sChocolate);
FormRead(0);
If sNuts = "1" THEN
! add the nuts
END
IF sCherrys = "1" THEN
! add the cherrys
END
IF sChocolate = "1" THEN
! add the chocolate
END
END

See Also

Form Functions