Next: , Previous: , Up: The curses form library   [Contents][Index]


5.6.6 Color and attribute control for form fields

Procedure: set-field-fore! field attr
Procedure: set-field-back! field attr

The procedure set-field-fore! sets the attributes of the contents of a field, and set-field-back! set the attributes of the unused portion of a field.

They return the constants E_OK on success, E_BAD_ARGUMENT, or E_SYSTEM_ERROR.

Procedure: field-fore field
Procedure: field-back field

The procedure field-fore returns the attributes of the contents of a field, and field-back returns the attributes of the unused portion of a field.

Procedure: set-field-pad! field pad

The procedure set-field-pad! sets the character used as blank in the field to the codepoint pad.

They return the constants E_OK on success, E_BAD_ARGUMENT, or E_SYSTEM_ERROR.

Procedure: field-pad field

The procedure field-pad returns the codepoint used as the blank in field.

5.6.7 Field buffer control

There are functions to set and get the text in a field, as well as to check if that field has been modified.

Procedure: set-field-buffer! field buf value

The function set-field-buffer! sets the numbered buffer of the given field to contain a given string. Buffer 0 is the displayed value of the field; other numbered buffers may be allocated by applications through the nbuf argument of new-field but are not manipulated by the forms library.

Procedure: field-buffer field buffer

Returns a string that is the contents of the field. buffer zero is the visible buffer on the screen. A field may have other buffers if so allocated when the field was created using new-field.

Procedure: field-status? field

The returns the field status of field. The field status is set to a non-zero value whenever the field changes.

Procedure: set-field-status! field status

Sets the field status of field to status, a boolean.

Procedure: set-max-field field max

This procedure sets the maximum size for a dynamic field. An argument of zero turns off any maximum size threshold for that field.

5.6.8 Retrieving field characteristics

Procedure: field-info field

The procedure returns a six-element list of information about the field. The elements of the list are: height, width, row of upper-left corner, column of upper-left corner, number of off-screen rows, and number of working buffers. This information was stored when the field was created, and rows and columns may not be accurate.

Procedure: dynamic-field-info field

This procedure returns of the actual size of the field and its maximum size as a list. The elements of the list are: rows, column, and max size.

5.6.9 Retrieving field characteristics

Procedure: set-field-just! field justification

This procedure sets the justification attribute of a field to one of NO_JUSTIFICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or JUSTIFY_CENTER.

Procedure: field-just field

This procedure returns the justification attribute of field. It is one of NO_JUSTIFICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or JUSTIFY_CENTER.

5.6.10 Creating and destroying form fields

Procedure: new-field height width toprow leftcol offscreen nbuffers

The function new-field allocates a new field and initializes it from the parameters given: height, width, row of upper-left corner, column of upper-left corner, number off-screen rows, and number of additional working buffers.

Procedure: dup-field field toprow leftcol

The function dup-field duplicates a field at a new location. Most attributes (including current contents, size, validation type, buffer count, growth threshold, justification, foreground, background, pad character, options, and user pointer) are copied. Field status and the field page bit are not copied.

Procedure: free-field field

This explicitly releases the buffer in field, instead of waiting for the garbage collector to take care of it.

5.6.11 Setting and getting field options

Procedure: set-field-opts! field opts
Procedure: field-opts-on! field opts
Procedure: field-opts-off! field opts
Procedure: field-opts field

The function set-field-opts! sets all the given field’s option bits (field option bits may be logically-OR’ed together).

The function field-opts-on! turns on the given option bits, and leaves others alone.

The function field-opts-off! turns off the given option bits, and leaves others alone.

The function field-opts returns the field’s current option bits.

The following options are defined. All are on by default

O_VISIBLE

The field is displayed. If this option is off, display of the field is suppressed.

O_ACTIVE

The field is visited during processing. If this option is off, the field will not be reachable by navigation keys. Please notice that an invisible field appears to be inactive also.

O_PUBLIC

The field contents are displayed as data is entered.

O_EDIT

The field can be edited.

O_WRAP

Words that do not fit on a line are wrapped to the next line. Words are blank-separated.

O_BLANK

The field is cleared whenever a character is entered at the first position.

O_AUTOSKIP

Skip to the next field when this one fills.

O_NULLOK

Allow a blank field.

O_STATIC

Field buffers are fixed to field’s original size. Turn this option off to create a dynamic field.

O_PASSOK

Validate field only if modified by user.


Next: , Previous: , Up: The curses form library   [Contents][Index]