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


Adds a field control device (such as a button , check box, or edit field) to the current form. You should call this function only after the FormNew() function and before the FormRead() function. This function allows you to specify a control device with more detail than the other field functions.


FormField(Col, Row, Width, Height, Type, Buffer, Label, Fn [, maxTextLength] )


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


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


The width of the control device.


The height of the control device.


The type of control device:

0 - None

1 - Edit

2 - Edit Password

3 - Text

4 - Button

5 - OK button

6 - Cancel button

7 - Group box

8 - Radio button

9 - Check box


The output buffer for the field string. The default value of the control device is initialized to the value of the buffer. If you specify a Radio button or Check box, you should initialize the buffer to "0" or "1". The result of the field will also be set to "0" or "1".


The display label for a button, or the default label for an edit field


The callback function to call when the button is selected. Set to 0 to call no function. Please be aware that the Fn parameter needs to be of type INT, and the callback function cannot contain a blocking function. For types other than 4,5, and 6, set this argument to 0.


This optional parameter specifies the maximum length of input text for edit fields (this parameter is ignored for other controls). The default value is 0 meaning the string can have the maximum length allowed in the system (Cicode allows strings of 255 characters).

Return Value

The field handle if the field is successfully added, otherwise it will return -1.

Related Functions



! Display a form with check boxes to start
!! specific motors.
FUNCTION SelectMotor()
INT hform;
STRING check1 = "0";
STRING check2 = "0";
STRING check3 = "0";
hform = FormNew("Selection Menu", 26, 22, 6);
FormField(16, 1, 12, 1, 9, check1, "Primary ", 0);
FormField(16, 2, 12, 1, 9, check2, "Secondary", 0);
FormField(16, 3, 12, 1, 9, check3, "backup ", 0);
FormButton( 9, 20, " &Cancel ", 0, 2);
IF FormRead(0) = 0 THEN
IF check1 = "1" THEN
IF check2 = "1" THEN
IF check3 = "1" THEN

See Also

Form Functions