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

Justifying data in a field

Unlike menu items, which always occupy one line, form fields may occupy one or more lines (rows). Fields that occupy one line may be justified left, right, center, or not at all.

SYNOPSIS

   int set_field_just (field, justification)
   FIELD * field;
   int justification;
   

int field_just (field) FIELD * field;

Fields that occupy more than one line are not justified because the data entered typically extends into subsequent lines. Justification is also ignored on a one line field if the O_STATIC option is off or the field was dynamic and has grown beyond its original size. See ``Dynamically growable fields'' for more detail.

Field contents justification is not allowed for non-editable fields. However, if the field was already justified before making it, it will remain justified.

Setting the number of field columns (cols) and the minimum width or precision does not always determine where the data fits in the field -- there may be excess character space before or after the data. Function set_field_just lets you justify data in one of the following ways:


NO_JUSTIFICATION -
no justification processing (initial default)

JUSTIFY_LEFT -
left justify value in field

JUSTIFY_RIGHT -
right justify value in field

JUSTIFY_CENTER -
center value in the field
No matter what the justification, fields are automatically left justified as your end-user enters data and edits the field. Once field validation occurs upon the user's request to leave the field, ETI justifies the field as specified.

For instance, to left justify a name field and right justify an amount field, you can write:

   FIELD * name, * amount;
   

set_field_just (name, JUSTIFY_LEFT); /* left justify a field */

set_field_just (amount, JUSTIFY_RIGHT); /* right justify a field */

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

E_SYSTEM_ERROR -
system error

E_BAD_ARGUMENT -
bad justification

E_REQUEST_DENIED -
justification request denied
As with most other ETI functions, if one of these functions is passed a NULL field pointer, it assigns or fetches the system default. For instance, to change the system default from no justification to centering the value in its field, you write
   set_field_just( (FIELD *) 0, JUSTIFY_CENTER);
   				/* set new default */

Next topic: Setting the field foreground, background, and pad character
Previous topic: TYPE_REGEXP

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