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

FormListSelectText

Selects (highlights) a text entry in a Combo box or a List box while the form is displayed. The text to be selected needs to exist in the list. (Use the FormListAddText() function to add a text entry to a list.) Call this function only when the form is displayed, for example, from a field callback function.

Syntax

FormListSelectText(hForm, hField, Text)

hForm:

The form handle, returned from the FormNew() function. The form handle identifies the table where all data on the associated form is stored.

hField:

The field handle of the field currently selected.

Text:

The text to be selected. If this text is not present in the list, then no item will be selected (and this text will not be added).

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

FormListAddText, FormSetText

Example

/* Create a form with a list */
hForm = FormNew("Ingredients", 40, 10, 1);
hField = FormListBox(2,2,20,5,sBuf);
FormAddList("Flour");
FormAddList("Water");
FormAddList("Salt");
FormAddList("Sugar");
/* Display the form */
FormRead(1);
.. /*Select Flour */
FormListSelectText(hForm, hField, "Flour");

See Also

Form Functions