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

FormSetText

Sets new field text on a field. This function allows you to change field text while the form is displayed. Call this function only when the form is displayed, for example, from a field callback function.

If you are using this function on a Combo box or a List box, it will select the text from the Combo box or List box list. If no text exists in the Combo box or List box list, the function will add it.

Syntax

FormSetText(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. If the hField is a handle to the secure edit field created with FormSecurePassword, the text in the secure edit field will not be changed. However, when an empty string is passed to FormSetText(), the contents of the secure edit field will be cleared.

Text:

New field text.

Return Value

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

Related Functions

FormCurr, FormListSelectText, FormListAddText

Example

/* Create a form with a field */
hForm = FormNew("Ingredients", 40, 10, 1);
hField = FormPrompt(2,2,"Motor1:");
/* Display the form*/
FormRead(1);
..
/* Change the text in the field */
FormSetText(hForm, hField, "Pump1:");
..

See Also

Form Functions