Putting the Form or Menu on the Screen

You can control when the form or menu is placed on the screen by calling the form up function fm_up() or the menu up function mn_up(). fm_up() displays a form on the screen and prepares it for processing. The call for fm_up() is as follows:

int fm_up(dfmp)

DFORMPTR dfmp;        /* Data form to display            */

mn_up() prepares a menu for processing and places the menu on the screen. The call for mn_up() is as follows:

int mn_up(mfmp)

MFORMPTR mfmp;        /* Menu to display                */

fm_up() and mn_up() first initialize the form or menu by preparing the array of form items and allocating memory for any necessary field and data conversion buffers. The form items (menu fields, data fields, memo fields, pushbuttons, and scrollable regions) are also placed in an array in the order that they are defined or the order specified from within the Designer.

fm_up() and mn_up() then write or draw the background items (prompts and other text, boxes, and lines) in the form window by calling fm_updbg(). Background items are drawn or placed on the screen in the following order: (1) scrollable region background color, (2) lines, (3) boxes, and (4) text.

Next, each active item (menu field, data field, scrollable region, pushbutton) of the form is displayed in the form window with fm_updflds(). Items are displayed in the order that they will be processed. For forms created in code, this is the order in which the items were defined. In the case of Designer forms, the processing order (horizontal, vertical, or manual) is defined within the Designer.

Note that the prompts and fields associated with a scrollable region are displayed at this time; thus, the prompts for the fields in the scrollable region are displayed at this time and not by fm_updbg().

For a data form, the protected characters of each field (data, memo, or fields in scrollable regions) are displayed and the contents of the data variables for each field are converted and displayed in the fields with the proper video attribute (active, inactive, or skip).

The form window is then set on the screen.

Note: If you put a form on the screen with fm_up() or mn_up(), you must take the form off the screen in one of two ways: by calling the corresponding form down function, fm_dn() or mn_dn(); or by setting the window option AUTOUPDN to ON after the form has been displayed. Setting this window option will force Vermont Views to remove the form or menu from the screen when the user exits or quits from the form. Calling fm_dn() or mn_dn() allows you to control exactly when the form is removed from the screen.

You must take a form off the screen before freeing it. If you link with the development libraries, attempting to free a form or menu that is still displayed produces a development error.


Home Contents Previous Next