2002-02-20 20:45:42 +03:00
|
|
|
.\" $NetBSD: forms.3,v 1.7 2002/02/20 17:45:42 wiz Exp $
|
2001-07-08 16:10:28 +04:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2001
|
|
|
|
.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au
|
|
|
|
.\"
|
|
|
|
.\" This code is donated to The NetBSD Foundation by the author.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. The name of the Author may not be used to endorse or promote
|
|
|
|
.\" products derived from this software without specific prior written
|
|
|
|
.\" permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
2002-02-20 14:30:07 +03:00
|
|
|
.Dd January 1, 2001
|
2001-07-08 16:10:28 +04:00
|
|
|
.Dt FORMS 3
|
2002-01-15 05:47:02 +03:00
|
|
|
.Os
|
2001-07-08 16:10:28 +04:00
|
|
|
.Sh NAME
|
|
|
|
.Nm form
|
|
|
|
.Nd form library
|
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libform
|
|
|
|
.Sh SYNOPSIS
|
2002-02-07 10:00:09 +03:00
|
|
|
.Fd #include \*[Lt]form.h\*[Gt]
|
2001-07-08 16:10:28 +04:00
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
2002-02-20 14:30:07 +03:00
|
|
|
.Nm
|
2002-02-20 20:45:42 +03:00
|
|
|
library provides a terminal independent form system using the
|
2001-07-08 16:10:28 +04:00
|
|
|
.Xr curses 3
|
2002-01-15 05:47:02 +03:00
|
|
|
library. Before using the
|
2002-02-20 20:45:42 +03:00
|
|
|
.Nm
|
2001-07-08 16:10:28 +04:00
|
|
|
functions the terminal must be set up by
|
|
|
|
.Xr curses 3
|
|
|
|
using the
|
|
|
|
.Fn initscr
|
|
|
|
function or similar. Programs using
|
2002-02-20 14:30:07 +03:00
|
|
|
.Nm
|
2001-07-08 16:10:28 +04:00
|
|
|
functions must be linked with the
|
|
|
|
.Xr curses 3
|
|
|
|
library
|
2002-02-20 14:30:07 +03:00
|
|
|
.Fl lcurses .
|
2001-07-08 16:10:28 +04:00
|
|
|
.Pp
|
|
|
|
The
|
2002-02-20 14:30:07 +03:00
|
|
|
.Nm
|
2002-02-20 20:45:42 +03:00
|
|
|
library provides facilities for defining form fields, placing a form on the
|
2001-07-08 16:10:28 +04:00
|
|
|
terminal screen, assign pre and post change operations and setting the
|
2002-02-20 20:45:42 +03:00
|
|
|
attributes of both the form and its fields.
|
2002-02-20 14:30:07 +03:00
|
|
|
.Ss Defining default attributes for forms and fields
|
2001-07-08 16:10:28 +04:00
|
|
|
The
|
2002-02-20 14:30:07 +03:00
|
|
|
.Nm
|
2001-07-08 16:10:28 +04:00
|
|
|
library allows any settable attribute or option of both the form and field
|
|
|
|
objects to be defined such that any new form or field automatically inherits
|
|
|
|
the value as default. Setting the default value will not affect any field or
|
|
|
|
form that has already been created but will be applied to subsequent objects.
|
|
|
|
To set the default attribute or option the set routine is passed a NULL
|
|
|
|
pointer in the field or form parameter when calling the set routine. The
|
|
|
|
current default value can be retrieved by calling the get routine with a
|
|
|
|
NULL pointer for the field or form parameter.
|
|
|
|
.Pp
|
|
|
|
.ta 20
|
|
|
|
.nf
|
|
|
|
.ft 3
|
|
|
|
Form Routine Name Manual Page Name
|
|
|
|
.sp 0.5
|
|
|
|
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_max_page form_page(3)
|
|
|
|
form_opts form_opts(3)
|
|
|
|
form_opts_off form_opts(3)
|
|
|
|
form_opts_on form_opts(3)
|
|
|
|
form_page form_page(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_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)
|
|
|
|
.fi
|
|
|
|
.ft 1
|
|
|
|
.br
|
|
|
|
.ne 8
|
|
|
|
.Sh RETURN VALUES
|
|
|
|
Any function returning a string pointer will return NULL if an error
|
|
|
|
occurs. Functions returning an integer will return one of the
|
|
|
|
following:
|
|
|
|
.Pp
|
|
|
|
.ta 20
|
|
|
|
.nf
|
|
|
|
E_OK The function was successful
|
|
|
|
E_SYSTEM_ERROR There was a system error during the call.
|
|
|
|
E_BAD_ARGUMENT One or more of the arguments passed to the function
|
|
|
|
was incorrect.
|
|
|
|
E_POSTED The form is already posted.
|
|
|
|
E_CONNECTED An field was already connected to a form.
|
|
|
|
E_BAD_STATE The function was called from within an initialisation
|
|
|
|
or termination routine.
|
|
|
|
E_NO_ROOM The form does not fit within the subwindow.
|
|
|
|
E_NOT_POSTED The form is not posted
|
|
|
|
E_UNKNOWN_COMMAND The form driver does not recognise the request
|
|
|
|
passed to it.
|
|
|
|
E_NOT_SELECTABLE The field could not be selected.
|
|
|
|
E_NOT_CONNECTED The field is not connected to a form.
|
|
|
|
E_REQUEST_DENIED The form driver could not process the request.
|
|
|
|
E_INVALID_FIELD The field is invalid.
|
|
|
|
E_CURRENT The field is the active one on the form.
|
|
|
|
.fi
|
|
|
|
.ft 1
|
|
|
|
.br
|
|
|
|
.ne 8
|
|
|
|
.Sh SEE ALSO
|
2002-02-20 14:30:07 +03:00
|
|
|
.Xr curses 3 ,
|
|
|
|
.Xr menus 3
|
2001-08-05 06:13:19 +04:00
|
|
|
.Sh NOTES
|
|
|
|
This implementation of the forms library does depart in behaviour
|
2002-02-07 12:24:04 +03:00
|
|
|
subtly from the original AT \*[Am] T implementation. Some of the more
|
2001-08-05 06:13:19 +04:00
|
|
|
notable departures are:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width "circular fields" -compact
|
|
|
|
.It field wrapping
|
|
|
|
For multiline fields the data will be wrapped as it is entered, this
|
2002-02-07 12:24:04 +03:00
|
|
|
does not happen in the AT\*[Am]T implementation.
|
2001-08-05 06:13:19 +04:00
|
|
|
.It buffer 0
|
|
|
|
In this implementation, the contents of buffer 0 are always current
|
|
|
|
regardless of whether the field has been validated or not.
|
|
|
|
.It circular fields
|
2002-02-07 12:24:04 +03:00
|
|
|
In the AT\*[Am]T implementation fields are circular on a page, that is, a
|
2001-08-05 06:13:19 +04:00
|
|
|
next field from the last field will go to the first field on the
|
|
|
|
curent page. In this implementation a next field request on the last
|
|
|
|
field of a page will result in the forms library positioning the
|
|
|
|
cursor on the first field of the next page. If the field is the last
|
|
|
|
field in the form then going to the next field will be denied, in the
|
2002-02-07 12:24:04 +03:00
|
|
|
AT\*[Am]T it would result in the cursor being placed on the first field of
|
2001-08-05 06:13:19 +04:00
|
|
|
the first page.
|
|
|
|
.It buffer returns
|
|
|
|
In this implementation only the data entered by the user in the form
|
2002-02-07 12:24:04 +03:00
|
|
|
field will be returned, unlike the AT\*[Am]T library which would return the
|
2001-08-05 06:13:19 +04:00
|
|
|
contents of the field padded to the size of the field with the pad
|
|
|
|
character.
|
|
|
|
.El
|