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

FormNew

Creates a new data entry form and defines its size and mode. After the form is created, you can add fields, and then display the form.

Before you can display a form on the screen, you need to call this function to set the size and mode of the form, and then call the various form field functions, FormInput(), FormButton(), FormEdit() etc to add user input fields to the form. To display the form on the screen (to allow the user to enter data) call the FormRead() function.

Syntax

FormNew(Title, Width, Height, Mode)

Title:

The title of the form.

Width:

The character width of the form (1 to 131).

Height:

The character height of the form (1 to 131).

Mode:

The mode of the form:

0 - Default font and text spacing

1 - Small font

2 - Fixed pitch font

4 - Static text compression where the vertical spacing is reduced. This can cause formatting errors if buttons are too close, because the vertical spacing will be less than the height of a button.

8 - Keep the form on top of the CitectSCADA window.

16 - The current window cannot be changed or closed until the form is finished or cancelled.

32 - Makes a form with no caption.

128 - The form will not close if the ESC or ENTER key is pressed, unless you specifically define at least one button on the form which acts as an OK or Cancel button. For a form with no buttons, the ENTER key normally closes the form; this mode disables that behavior.

256 – Makes a from with no system-menu (mostly appears as a single close button X) .

Multiple modes can be selected by adding them (for example, to use Modes 4 and 2, specify Mode 6).

Return Value

The form handle if the form is created successfully, otherwise -1 is returned. The form handle identifies the table where all data on the associated form is stored.

Related Functions

FormDestroy, FormInput, FormButton, FormEdit, FormRead

Example

FormNew("Recipe",30,5,0);
FormInput(1,1,"Recipe No",Recipe,20);
FormInput(1,2,"Amount",Amount,10);
FormRead(0);

See Also

Form Functions