DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
ETI forms

Determining the dimensions of forms

Every form is associated with a window and subwindow.


NOTE: By default, (1) the form window is NULL, which by convention means that ETI uses stdscr as the form window; and (2) the form subwindow is NULL, which means that ETI uses the form window as the form subwindow.

Windows are used to create borders, titles, and the like. Before ETI posts a form, it must determine the sizes of its window and subwindow.

To determine the minimum window or subwindow size for a form, ETI considers the following:

By automatically fetching this information previously established by calls to new_field, function scale_form saves you the effort of calculating the size of your form subwindow.

Scaling the form

Considering the above information, this function returns the minimum window size necessary for containing the form.

SYNOPSIS

   int scale_form (form, rows, cols)
   FORM * form;
   int * rows;
   int * cols;
Because function scale_form must return more than one value (namely, the minimum number of rows and columns for the form) and C passes parameters ``by value'' only, scale_form are pointers. The pointer arguments rows and cols point to locations used to return the minimum number of rows and columns for the form.


NOTE: You should call scale_menu only after the form's fields have been connected to the form using new_form or set_form_fields.

As an example, to return the minimum (sub)window size for form f in variables rows and cols, you can write:

   FORM * form;
   int rows, cols;
   

/* create fields create form */

/* determine minimum row and column size */ scale_form (form, &rows, &cols);

/* create form subwindow, as described in next section */

If function scale_form encounters an error, it returns one of the following:

E_SYSTEM_ERROR -
system error

E_BAD_ARGUMENT -
NULL form pointer

E_NOT_CONNECTED -
no fields connected to the form

Next topic: Associating windows and subwindows with a form
Previous topic: Displaying forms

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004