Creating an Error Message Window

Vermont Views defines a global error window, ERR_WNP, and automatically associates that window with each form you define in your application. If you do not want to use the Vermont Views error window, you can create your own.

The following code creates a one row window for error messages on the last row of the screen. The window has no border and has attribute LERROR.

WINDOWPTR err_wnp;

err_wnp = wn_def(vs_rowq() - 1, 0, 1, vs_colq(), LERROR, BDR_NULLP);

sw_opt(AUTOCLEAR, ON, err_wnp);

vs_rowq() and vs_colq() return the number of rows and columns, respectively for the current screen.

To write an error message:

v_st("Undefined key", err_wnp);

wn_up(err_wnp);

To remove the message:

wn_dn(err_wnp);    /* remove the window from the screen */

The AUTOCLEAR option set in the call to sw_opt() forces Vermont Views to clear the error window's buffer each time the window is taken off the screen. If this option were not turned on for this window, the user would see the message "Undefined key" in the window the next time the window was put on the screen.


Home Contents Previous Next