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


Adds a list box to the current form. The list box is a form control that allows the operator to select from a list of items. You should call this function only after the FormNew() function and before the FormRead() function.

The list box is added to the form at the specified column and row position with the specified width and height. If more items are placed in the list than the list can display, a scroll bar displays for scrolling to the hidden items.

Use the FormAddList() function to add items for display in the list box. If the form is already displayed, you can use the FormListAddText() and FormListSelectText() functions to add (and highlight) text in the list box.


FormListBox(Col, Row, Width, Height, sBuf [, Mode] )


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


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


The width of the list box, in characters. Width should be wide enough to display your widest item. Items wider than the list box are clipped.


The height of the list box, as the number of items that can be seen in the list box without scrolling.


The string buffer in which to store the selected item.


The mode in which to create the list box:

0 - Sort the list box elements alphabetically.

1 - Place elements in list box in the order they were added.

Mode 0 is the default.

Return Value

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

Related Functions

FormNew, FormRead, FormAddList, FormListAddText, FormListSelectText, FormComboBox


! Create a form, add list box and then display the form.
! The operator may select one of the items from the list.
FormNew("Select Item",20,6,1);
FormListBox(2 ,2, 15, 5, sBuf, 1);
FormAddList("Item One");
FormAddList("Item two");
FormAddList("Item three");
FormButton(0,0," OK ",0,1);
FormButton(5,0," CANCEL ",0,2);

See Also

Form Functions