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

Setting the field foreground, background, and pad character

The following functions enable you to set and read the pad character and the low-level ETI (curses) attributes associated with your field's foreground and background. The foreground attribute applies only to those field characters that represent data proper, while the background attribute applies to the entire field.

SYNOPSIS

   int set_field_fore (field, attr)
   FIELD * field;
   chtype attr;
   

chtype field_fore (field) FIELD * field;

int set_field_back (field, attr) FIELD * field; chtype attr;

chtype field_back (field) FIELD * field;

int set_field_pad (field, pad) FIELD * field; int pad;

int field_pad (field) FIELD * field;

The initial default for both the foreground and background are A_NORMAL. (See ``Output attributes'' and the curses(3ocurses) pages for more on screen attributes.) The pad character is the character displayed wherever a blank occurs in the field value stored in field buffer 0.

As an example, to change the background of a field total to A_UNDERLINE and A_STANDOUT, you write:

   FIELD * total;
   

set_field_back (total, A_UNDERLINE | A_STANDOUT);

If function set_field_fore or set_field_back encounter an error, they return one of the following:


E_SYSTEM_ERROR -
system error

E_BAD_ARGUMENT -
bad curses attribute
The function set_field_pad sets the field's pad character. The default pad character is a blank. During form processing, pad characters in the field are translated to blanks in the field's value.


NOTE: Because ETI does not distinguish between system-generated pad characters and those entered as data, be sure to choose your pad character so as not to conflict with valid data.

To set the pad character for field total to an asterisk (*), you write:

   FIELD * total;
   

set_field_pad (total, '*');

If successful, function set_field_pad returns E_OK. If not, it returns one of the following:

E_SYSTEM_ERROR -
system error

E_BAD_ARGUMENT -
nonprintable pad character
As usual, you can change or access the ETI defaults. To change the default background to A_UNDERLINE, you write:
   set_field_back ((FIELD *) 0, A_UNDERLINE);

Next topic: Some helpful features of fields
Previous topic: Justifying data in a field

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