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

FormRadioButton

Adds a radio button to the current form, allowing the operator to make a selection from a multiple choice list. You should call this function only after the FormNew() function and before the FormRead() function.

The radio button is added to the form at the specified column and row position. The width of the button will be sized to suit the text.

By default, all radio buttons are placed into the one group. If you require separate groups, use this function in conjunction with the FormGroupBox() function.

Syntax

FormRadioButton(Col, Row, sText, sBuf)

Col:

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

Row:

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

sText:

The text associated with the radio button.

sBuf:

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

Return Value

The field handle if the radio button is successfully added, otherwise -1 is returned.

Related Functions

FormNew, FormRead, FormGroupBox, FormCheckBox

Example

! Create a form, add radio buttons and then display the form.
! The operator may only select one radio button , either Fast, Medium or Slow
FUNCTION FnMenu()
STRING sFast, sSlow, sMedium;
sFast = "1";
sMedium = "0";
sSlow = "0";
FormNew("Speed",20,6,1);
FormRadioButton(2 ,2,"Fast", sFast);
FormRadioButton(2, 3,"Medium", sMedium);
FormRadioButton(2 ,4,"Slow", sSlow);
FormRead(0);
If sFast = "1" THEN
! do fast stuff
ELSE
IF sMedium = "1" THEN
! do Medium stuff
ELSE
IF sSlow = "1" THEN
! do slow stuff
END
END

See Also

Form Functions