[][src]Module ncursesw::form

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.,

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

so that input/output processing will work.

Structs

FieldInfo

Form field details.

FieldOptions

Field options.

FieldParameters

Field parameters when defining a new form field.

FormOptions

Form options.

Enums

FieldJustification

Field justification.

FieldOption

Field option.

FormOption

Form option.

FormRequest

Form request.

NCurseswFormError

NCursesw form errors.

Functions

current_field

Returns the current field of the given form.

data_ahead

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

data_behind

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

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.

dynamic_field_info

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().

field_arg
field_back

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

field_buffer

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

field_count

Returns the count of fields in form.

field_fore

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

field_index

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

field_info

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.

field_init

Returns the current field init hook.

field_just

Returns a field's justification attribute.

field_opts

Returns the field's current options.

field_opts_off

Turns off the given options, and leaves others alone.

field_opts_on

Turns on the given options, and leaves others alone.

field_pad

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

field_status

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

field_term

Returns the current field term hook.

field_type

Returns the data type validation for fields.

field_userptr

Returns the fields user pointer.

form_driver

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

form_driver_w

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.

form_fields

Returns a vector of the fields of the given form.

form_init

Returns the current form init hook.

form_opts

Returns the form's current options.

form_opts_off

Turns off the given options, and leaves others alone.

form_opts_on

Turns on the given options, and leaves others alone.

form_page

Returns the form's current page number.

form_request_by_name

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

form_request_name

Returns the printable name of a form request code.

form_sub

Return the forms sub-window.

form_term

Returns the current form term hook.

form_userptr

Returns the forms user pointer.

form_win

Return the forms main-window.

free_field

De-allocates storage associated with a field.

free_fieldtype
free_form

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

link_field

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

link_fieldtype
move_field

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

ncursesw_form_error_from_rc
new_field

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.

new_fieldtype
new_form

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).

new_form_sp

Screen function of new_form().

new_page

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

pos_form_cursor

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.

post_form

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).

scale_form

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

set_current_field

Sets the current field of the given form.

set_field_back

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

set_field_buffer

Sets the associated status flag of field; field_status gets the current value. The status flag is set to a nonzero value whenever the field changes.

set_field_fore

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

set_field_init

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

set_field_just

Sets the justification attribute of a field.

set_field_opts

Sets all the given field's options.

set_field_pad

Sets the character used to fill the field.

set_field_status

Sets the associated status flag of field.

set_field_term

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

set_field_type

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

set_field_userptr

Sets the fields user pointer.

set_fieldtype_arg
set_fieldtype_choice
set_form_fields

Changes the field pointer array of the given form.

set_form_init

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

set_form_opts

Sets all the given form's options.

set_form_page

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

set_form_sub

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

set_form_term

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

set_form_userptr

Sets the forms user pointer.

set_form_win

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

set_max_field

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

set_new_page

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

unfocus_current_field

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

unpost_form

Erases form from its associated sub-window.

Type Definitions

FIELD

Form field.

FIELDTYPE

Form field type.

FORM

Form.

Form_Hook

Form callback function.