|
|
When you have created a form and its window and subwindow, you are ready to post it. To post a form is to display it on the form's subwindow; to unpost a form is to erase it from the form's subwindow.
SYNOPSIS
int post_form (form) FORM form;Unposting a form does not remove its data structure from memory.int unpost_form (form) FORM form;
``Posting and unposting a form'' uses two application routines, display_form and erase_form, to show how you might post and later unpost a form. The code builds on that used previously in ``Creating a border around a form'' to create the form's window and subwindow.
static void display_form (f) /* create form windows and post */ FORM * f; { WINDOW * w; int rows; int cols;scale_form (f, &rows, &cols); /* get dimensions of form */
/* create form window */
if (w = newwin (rows+4, cols+4, 0, 0)) { set_form_win (f, w); set_form_sub (f, derwin (w, rows, cols, 2, 2)); box (w, 0, 0); keypad (w, 1); } else /* error routine in previous section "ETI Low-level Interface to High-level Functions" */ error ("error return from newwin", NULL);
if (post_form (f) != E_OK) /* post form */
error ("error return from post_form", NULL); else refresh (w); }
static void erase_form (f) /* unpost and delete form windows */ FORM * f; { WINDOW * w = form_win (f); WINDOW * s = form_sub (f);
unpost_form (f); /* unpost form */ werase (w); /* erase form window */ wrefresh (w); /* refresh screen */ delwin (s); /* delete form windows */ delwin (w); }
Posting and unposting a form
If successful, function post_form returns E_OK. If not, it returns one of the following: