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

Setting and fetching form options

ETI provides form options regulating how specific user requests are handled. These functions enable you to set the options and read their settings.

SYNOPSIS

   int set_form_opts (form, opts)
   FORM * form;
   OPTIONS opts;
   

OPTIONS form_opts (form) FORM * form;

options: O_NL_OVERLOAD O_BS_OVERLOAD

Note that function set_form_opts automatically turns off all form options not referenced in its second argument. By default, all options are on.

The effects of the options are as follows:


O_NL_OVERLOAD
determines how a REQ_NEW_LINE request is processed. If O_NL_OVERLOAD is on, the request is overloaded. See ``Field editing requests'' for a description of overloading. If O_NL_OVERLOAD is off, the REQ_NEW_LINE request behavior depends on whether insert mode is on.

In insert mode, the REQ_NEW_LINE request first inserts a new line after the current line. It then moves the text on the current line starting at the cursor position to the beginning of the new line. The cursor is repositioned to the beginning of the new line.

In overlay mode, the REQ_NEW_LINE request erases all data from the cursor position to the end of the line. It then repositions the cursor at the beginning of the next line.

If the field option O_STATIC if off and there is no maximum growth specified for the field, the overloaded form driver request REQ_NEW_LINE will operate the same way regardless of the setting of the O_NL_OVERLOAD form option. If a field can grow without bound, there is no last line, so REQ_NEW_LINE will never implicitly generate a REQ_NEXT_FIELD. If a maximum growth limit is specified and the O_NL_OVERLOAD form option is on, REQ_NEW_LINE will only implicitly generate REQ_NEXT_FIELD if the field has grown to its maximum size and the user is on the last line.


O_BS_OVERLOAD
determines how a REQ_DEL_PREV request is processed. If O_BS_OVERLOAD is on, the request is overloaded. See ``Field editing requests'' for information on overloading. If O_BS_OVERLOAD is off, the REQ_DEL_PREV request depends on whether insert mode is on.

In insert mode, if the cursor is at the beginning of any line except the first and the text on the line will fit at the end of the previous line, the text is appended to the previous line and the current line is deleted. If not, the REQ_DEL_PREV request simply deletes the previous character, if there is one. If the cursor is at the first character of the field, the form driver simply returns E_REQUEST_DENIED.

In overlay mode, the REQ_DEL_PREV request simply deletes the previous character, if there is one.

Options are Boolean values, so you use Boolean operators to turn them on or off. For example, to turn off option O_NL_OVERLOAD of form f0 and turn on the same option of form f1, you write:
   FORM * f0, * f1;
   

set_form_opts (f0, form_opts (f0) & ~O_NL_OVERLOAD); /* turn option off */ set_form_opts (f1, form_opts (f1) | O_NL_OVERLOAD); /* turn option on */

ETI provides two more functions to turn options on and off.

SYNOPSIS

   int form_opts_on (form, opts)
   FORM * form;
   OPTIONS opts;
   

int form_opts_off (form, opts) FORM * form; OPTIONS opts;

Unlike function set_form_opts, these functions do not affect options unreferenced in their second argument.

Another way to turn off option O_NL_OVERLOAD on form f0 and turn it on on form f1 is to write

   FORM * f0, * f1;
   

form_opts_off (f0, O_NL_OVERLOAD); /* turn option off */ form_opts_on (f1, O_NL_OVERLOAD); /* turn option on */

If functions set_form_opts, form_opts_off, or form_opts_on encounter an error, they return the following:

E_SYSTEM_ERROR -
system error
To change the current system default from, say, O_NL_OVERLOAD to not-O_NL_OVERLOAD without affecting the O_BS_OVERLOAD option, you write:
   form_opts_off( (FORM *) 0, O_NL_OVERLOAD);

Next topic: Creating and manipulating programmer-defined field types
Previous topic: Pattern match example using form user pointer

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