DragonFly On-Line Manual Pages
form(3) form(3)
NAME
form - curses extension for programming forms
SYNOPSIS
#include <form.h>
DESCRIPTION
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 inter-
action with the user.
The form library uses the curses libraries. To use the form library,
link with the options -lform -lcurses.
Your program should set up the locale, e.g.,
setlocale(LC_ALL, "");
so that input/output processing will work.
A curses initialization routine such as initscr must be called before
using any of these functions.
Current Default Values for Field Attributes
The form library maintains a default value for field attributes. You
can get or set this default by calling the appropriate set_ or
retrieval routine with a NULL field pointer. Changing this default
with a set_ function affects future field creations, but does not
change the rendering of fields already created.
Routine Name Index
The following table lists each form routine and the name of the manual
page on which it is described.
curses Routine Name Manual Page Name
------------------------------------------------
current_field form_page(3)
data_ahead form_data(3)
data_behind form_data(3)
dup_field form_field_new(3)
dynamic_field_info form_field_info(3)
field_arg form_field_validation(3)
field_back form_field_attributes(3)
field_buffer form_field_buffer(3)
field_count form_field(3)
field_fore form_field_attributes(3)
field_index form_page(3)
field_info form_field_info(3)
field_init form_hook(3)
field_just form_field_just(3)
field_opts form_field_opts(3)
field_opts_off form_field_opts(3)
field_opts_on form_field_opts(3)
field_pad form_field_attributes(3)
field_status form_field_buffer(3)
field_term form_hook(3)
field_type form_field_validation(3)
field_userptr form_field_userptr(3)
form_driver form_driver(3)
form_fields form_field(3)
form_init form_hook(3)
form_opts form_opts(3)
form_opts_off form_opts(3)
form_opts_on form_opts(3)
form_page form_page(3)
form_request_by_name form_requestname(3)
form_request_name form_requestname(3)
form_sub form_win(3)
form_term form_hook(3)
form_userptr form_userptr(3)
form_win form_win(3)
free_field form_field_new(3)
free_fieldtype form_fieldtype(3)
free_form form_new(3)
link_field form_field_new(3)
link_fieldtype form_fieldtype(3)
move_field form_field(3)
new_field form_field_new(3)
new_fieldtype form_fieldtype(3)
new_form form_new(3)
new_page form_new_page(3)
pos_form_cursor form_cursor(3)
post_form form_post(3)
scale_form form_win(3)
set_current_field form_page(3)
set_field_back form_field_attributes(3)
set_field_buffer form_field_buffer(3)
set_field_fore form_field_attributes(3)
set_field_init form_hook(3)
set_field_just form_field_just(3)
set_field_opts form_field_opts(3)
set_field_pad form_field_attributes(3)
set_field_status form_field_buffer(3)
set_field_term form_hook(3)
set_field_type form_field_validation(3)
set_field_userptr form_field_userptr(3)
set_fieldtype_arg form_fieldtype(3)
set_fieldtype_choice form_fieldtype(3)
set_form_fields form_field(3)
set_form_init form_hook(3)
set_form_opts form_field_opts(3)
set_form_page form_page(3)
set_form_sub form_win(3)
set_form_term form_hook(3)
set_form_userptr form_userptr(3)
set_form_win form_win(3)
set_max_field form_field_buffer(3)
set_new_page form_new_page(3)
unpost_form form_post(3)
RETURN VALUE
Routines that return pointers return NULL on error, and set errno to
the corresponding error-code returned by functions returning an inte-
ger. Routines that return an integer return one of the following error
codes:
E_OK The routine succeeded.
E_BAD_ARGUMENT
Routine detected an incorrect or out-of-range argument.
E_BAD_STATE
Routine was called from an initialization or termination function.
E_CONNECTED
The field is already connected to a form.
E_INVALID_FIELD
Contents of a field are not valid.
E_NOT_CONNECTED
No fields are connected to the form.
E_NOT_POSTED
The form has not been posted.
E_NO_ROOM
Form is too large for its window.
E_POSTED
The form is already posted.
E_REQUEST_DENIED
The form driver could not process the request.
E_SYSTEM_ERROR
System error occurred (see errno).
E_UNKNOWN_COMMAND
The form driver code saw an unknown request code.
SEE ALSO
curses(3) and related pages whose names begin "form_" for detailed
descriptions of the entry points.
NOTES
The header file <form.h> automatically includes the header files
<curses.h> and <eti.h>.
In your library list, libform.a should be before libncurses.a; that is,
you want to say `-lform -lncurses', not the other way around (which
would give you a link error using most linkers).
PORTABILITY
These routines emulate the System V forms library. They were not sup-
ported on Version 7 or BSD versions.
AUTHORS
Juergen Pfeifer. Manual pages and adaptation for ncurses by Eric S.
Raymond.
SEE ALSO
This describes ncurses version @NCURSES_MAJOR@.@NCURSES_MINOR@ (patch
@NCURSES_PATCH@).
form(3)
form_fieldtype(3X) form_fieldtype(3X)
NAME
form_fieldtype - define validation-field types
SYNOPSIS
#include <form.h>
FIELDTYPE *new_fieldtype(
bool (* const field_check)(FIELD *, const void *),
bool (* const char_check)(int, const void *));
int free_fieldtype(FIELDTYPE *fieldtype);
int set_fieldtype_arg(
FIELDTYPE *fieldtype,
void *(* const make_arg)(va_list *),
void *(* const copy_arg)(const void *),
void (* const free_arg)(void *));
int set_fieldtype_choice(
FIELDTYPE *fieldtype,
bool (* const next_choice)(FIELD *, const void *),
bool (* const prev_choice)(FIELD *, const void *));
FIELDTYPE *link_fieldtype(FIELDTYPE *type1,
FIELDTYPE *type2);
DESCRIPTION
new_fieldtype
The function new_fieldtype creates a new field type usable for data
validation. Its parameters are function pointers:
field_check
This function checks the validity of an entered data string
whenever the user attempts to leave a field. It has two
arguments:
o The (FIELD *) argument is passed in so the validation
predicate can see the field's buffer, sizes and other
attributes.
o The second argument is an argument-block structure, about
which more below.
char_check
This function validates input characters as they are entered. The
form library passes it the character to be checked and a pointer
to an argument-block structure.
free_fieldtype
The free_fieldtype function frees the space allocated for a given
validation type by new_fieldtype.
set_fieldtype_arg
The function set_fieldtype_arg associates three storage-management
functions with a field type:
make_arg
This function is automatically applied to the list of arguments
you give set_field_type when attaching validation to a field. It
stores the arguments in an allocated argument-block object which
is used when validating input.
copy_arg
This function may be used by applications to copy argument-blocks.
free_arg
Frees an argument-block structure.
You must supply the make_arg function. The other two are optional: you
may supply NULL for them. In this case, the form library assumes that
make_arg does not allocate memory but simply loads the argument into a
single scalar value.
set_fieldtype_choice
The form driver requests REQ_NEXT_CHOICE and REQ_PREV_CHOICE assume
that the possible values of a field form an ordered set, and provide
the forms user with a way to move through the set.
The set_fieldtype_choice function allows forms programmers to define
successor and predecessor functions for the field type. These
functions take the field pointer and an argument-block structure as
arguments.
link_fieldtype
The function link_fieldtype creates a new field type from the two given
types. They are connected by an logical 'OR'.
RETURN VALUE
The pointer-valued routines return NULL on error. They set errno
according to their success:
E_OK The routine succeeded.
E_BAD_ARGUMENT
Routine detected an incorrect or out-of-range argument.
E_SYSTEM_ERROR
System error occurred, e.g., malloc failure.
The integer-valued routines return one of the following codes on error:
E_OK The routine succeeded.
E_BAD_ARGUMENT
Routine detected an incorrect or out-of-range argument.
E_CONNECTED
The field is already connected to a form.
E_CURRENT
The field is the current field.
E_SYSTEM_ERROR
System error occurred (see errno(3)).
SEE ALSO
curses(3X), form(3X), form_field_validation(3X).
NOTES
The header file <form.h> automatically includes the header file
<curses.h>.
PORTABILITY
These routines emulate the System V forms library. They were not
supported on Version 7 or BSD versions.
AUTHORS
Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S.
Raymond.
form_fieldtype(3X)