Forms are created in much the same way as menus. First, the fields
related to the form are created with
new-field. You can set
options for the fields, so that they can be displayed with some fancy
attributes, validated before the field looses focus, etc. Then the
fields are attached to the form. After this, the form can be posted
to display and is ready to receive inputs. Along similar lines to
menu-driver, the form is manipulated with
We can send requests to
form-driver to move focus to a certain
field, move the cursor to the end of the field, and so on. After the
user enters the values in the fields and validation is done, the form
can be unposted and the memory allocated can be freed.
The general flow of control of a form program looks like this
new-field. You can specify the height and width of the field, and its position on the form.
new-formby specifying the fields to be attached.
form-postand refresh the screen.
The forms library is similar to the menu library. The following examples will explore various aspects of form processing. Let’s stat the journey with a simple example first.