Modifying the Error Window

When the system validation function finds that the user has entered an invalid response in a field, the function sets an error code. The form editor responds by setting the error window on the screen and displaying an error message.

A default error window is initially defined in vv_init() as window with no border. The error window covers the last row of the screen, and the logical attribute of the window is LERROR. The pointer to this window is #defined as ERR_WNP. When a form is defined, the pointer to ERR_WNP is copied to one of the form structure members.

Designer: You cannot change the error window from within the Designer; you must change it in your code.

Code: You can use any of the window functions discussed in Chapter 25, "Changing the Appearance of Windows," to modify the error window ERR_WNP.

For example, to change the attribute of the error window, call:

sw_att(LURGENT, ERR_WNP);

To make a two-line error window, call:

wn_mod(vs_rowq() - 3, 0, 2, vs_colq(), ERR_WNP);

After making these changes, the error window for all forms in your application will be displayed with these properties.

Note: vs_rowq() and vs_colq() are functions that return the number of rows and columns, respectively, for the screen.

General: Note that each form does not have its own copy of the error window. Since each form points to the same error window, any modifications you make to ERR_WNP will affect the error window for all forms in your application. However, you can define a new error window for a specific form by calling wn_def() and storing the returned pointer in the error window member of the form structure. You can then modify that error window without affecting the error window used for other forms.


Home Contents Previous Next