Expand description

NCurses Form module

The form library provides terminal-independent facilities for composing form screens on character-cell terminals. The library includes: field routines, which create and modify form fields; and form routines, which group fields into forms, display forms on the screen, and handle interaction with the user.

Your program should set up the locale, e.g.,

use gettextrs;

ncursesw::setlocale(LcCategory::All, "")?;

so that input/output processing will work.

Structs

Form field details.

Field options.

Field parameters when defining a new form field.

Form options.

Enums

Field justification.

Field option.

Form option.

Form request.

NCursesw form errors.

Functions

Returns the current field of the given form.

Tests whether there is off-screen data ahead in the given form.

Tests whether there is off-screen data behind in the given form.

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.

Returns the actual size of the field, and its maximum possible size. If the field has no size limit, the return max will be set to 0. A field can be made dynamic by turning off the FieldOptions::Static option with field_opts_off().

Returns the background attribute. The default is normal::Attributes::Normal.

Returns a vector of the contents of the given numbered buffer:

Returns the count of fields in form.

Returns the foreground attribute. The default is normal::Attributes::Standout.

Returns the index of the field in the field array of the form it is connected to.

Returns the sizes and other attributes passed in to the field at its creation time. The attributes are: height, width, row of upper-left corner, column of upper-left corner, number off-screen rows, and number of working buffers.

Returns the current field init hook.

Returns a field’s justification attribute.

Returns the field’s current options.

Turns off the given options, and leaves others alone.

Turns on the given options, and leaves others alone.

Returns the given form’s pad character. The default is a blank.

Gets the current field status value. The status is true whenever the field changes.

Returns the current field term hook.

Returns the data type validation for fields.

Returns the fields user pointer.

Once a form has been posted (displayed), you should funnel input events to it through form_driver().

This extension simplifies the use of the forms library using wide characters. The input is either a key code (a request) or a wide character returned by get_wch(). The type must be passed as well, to enable the library to determine whether the parameter is a wide character or a request.

Returns a vector of the fields of the given form.

Returns the current form init hook.

Returns the form’s current options.

Turns off the given options, and leaves others alone.

Turns on the given options, and leaves others alone.

Returns the form’s current page number.

Searches in the name-table for a request with the given name and returns its request code as a Some. Otherwise None is returned.

Returns the printable name of a form request code.

Return the forms sub-window.

Returns the current form term hook.

Returns the forms user pointer.

Return the forms main-window.

De-allocates storage associated with a field.

The function free_form() disconnects form from its field array and frees the storage allocated for the form.

Acts like dup_field(), but the new field shares buffers with its parent. Attribute data is separate.

Moves the given field (which must be disconnected) to a specified location on the screen.

Allocates a new field and initializes it from the contents of a FieldPrameters type given: height, width, row of upper-left corner, column of upper-left corner, number off-screen rows, and number of additional working buffers.

Creates a new form connected to specified fields as a vector (the vector must point to an area of contiguous memory representing the fields in order).

Screen function of new_form().

The function new_page() is a predicate which tests if a given field marks a page beginning on its form.

Restores the cursor to the position required for the forms driver to continue processing requests. This is useful after NCurses routines have been called to do screen-painting in response to a form operation.

Displays a form to its associated sub-window. To trigger physical display of the sub-window, use refresh() or some equivalent NCurses routine (the implicit doupdate() triggered by a NCurses input request will do).

Returns the minimum size required for the sub-window of form.

Sets the current field of the given form.

Sets the background attribute of form. This is the highlight used to display the extent fields in the form.

Sets the numbered buffer of the given field to contain a given string:

Sets the foreground attribute of field. This is the highlight used to display the field contents.

Sets a hook to be called at form-post time and each time the selected field changes (after the change).

Sets the justification attribute of a field.

Sets all the given field’s options.

Sets the character used to fill the field.

Sets the associated status flag of field.

Sets a hook to be called at form-unpost time and each time the selected field changes (before the change).

Declares a data type for a given form field. This is the type checked by validation functions.

Sets the fields user pointer.

Changes the field pointer array of the given form.

Sets a hook to be called at form-post time and just after a page change once it is posted.

Sets all the given form’s options.

Sets the form’s page number (goes to page n of the form).

Sets the forms sub-window. if form is None then window is default for all forms, if window is None the stdscr() is used.

Sets a hook to be called at form-unpost time and just before a page change once it is posted.

Sets the forms user pointer.

Sets the forms main-window. if form is None then window is default for all forms, if window is None the stdscr() is used.

Sets the maximum size for a dynamic field. An argument of 0 turns off any maximum size threshold for that field.

Sets or resets a flag marking the given field as the beginning of a new page on its form.

Removes the focus from the current field of the form. In such state, inquiries via current_field() will error.

Erases form from its associated sub-window.

Type Definitions

Form field.

Form field type.

Form.

Form callback function.