NetBSD/lib/libform/form_field_opts.3
2004-11-24 12:09:13 +00:00

158 lines
4.8 KiB
Groff

.\" $NetBSD: form_field_opts.3,v 1.10 2004/11/24 12:09:13 wiz Exp $
.\"
.\" 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.
.\"
.Dd November 24, 2004
.Dt FORMS 3
.Os
.Sh NAME
.Nm field_opts ,
.Nm field_opts_off ,
.Nm field_opts_on ,
.Nm set_field_opts
.Nd form library
.Sh LIBRARY
.Lb libform
.Sh SYNOPSIS
.In form.h
.Ft Form_Options
.Fn field_opts "FIELD *field"
.Ft int
.Fn field_opts_off "FIELD *field" "Form_Options options"
.Ft int
.Fn field_opts_on "FIELD *field" "Form_Options options"
.Ft int
.Fn set_field_opts "FIELD *field" "Form_Options options"
.Sh DESCRIPTION
The function
.Fn field_opts
returns the current options settings for the given field.
The
.Fn field_opts_off
will turn the options given in
.Fa options
off for the given field, options not specified in
.Fa options
will remain unchanged.
Conversely, the function
.Fn field_opts_on
will turn on the options given in
.Fa options
for the specified field, again, any options not specified will remain
unchanged.
The options for a field may be set to a specific set of
options by calling the
.Fn set_field_opts
function.
Options may only be changed if the field given is not the
currently active one.
.Sh PARAMETERS
The following options are available for a field:
.Pp
.Bl -tag -width O_REFORMAT -compact
.It Dv O_VISIBLE
The field is visible, hence is displayed when the form is posted.
.It Dv O_ACTIVE
The field is active in the form, meaning that it can be visited during
form processing.
.It Dv O_PUBLIC
The contents of the field are echoed to the screen.
.It Dv O_EDIT
The contents of the field can be modified
.It Dv O_WRAP
The contents of the field are wrapped on a word boundary, if this
option is off then the field will be wrapped on a character boundary.
.It Dv O_BLANK
Blank the field on new data being entered if and only if the field
cursor is at the left hand side of the field.
.It Dv O_AUTOSKIP
Skip to the next field when the current field reaches its maximum
size.
.It Dv O_NULLOK
The field is allowed to contain no data
.It Dv O_STATIC
The field is not dynamic, it has a fixed size.
.It Dv O_PASSOK
An unmodified field is allowed.
.It Dv O_REFORMAT
Retain the formatting of a field when the buffer is retrieved.
If this option is not set then the buffer returned will be a single string
with no line breaks.
When this option is set newline characters will be inserted at the point
where the string has been wrapped in a multiline field.
This option is an extension to the forms library and must not be used
in portable code.
See the
.Xr field_buffer 3
man page for how this option modifies the behaviour of
.Fn field_buffer .
.El
.Pp
The following options are on by default for a field:
.Dv O_VISIBLE ,
.Dv O_ACTIVE ,
.Dv O_PUBLIC ,
.Dv O_EDIT ,
.Dv O_WRAP ,
.Dv O_BLANK ,
.Dv O_AUTOSKIP ,
.Dv O_NULLOK ,
.Dv O_PASSOK ,
and
.Dv O_STATIC .
.Sh RETURN VALUES
Functions returning pointers will return
.Dv NULL
if an error is detected.
The functions that return an int will return one of the following error
values:
.Pp
.Bl -tag -width E_UNKNOWN_COMMAND -compact
.It Er E_OK
The function was successful.
.It Er E_CURRENT
The field specified is the currently active one in the form.
.El
.Sh SEE ALSO
.Xr curses 3 ,
.Xr forms 3
.Sh NOTES
The header
.Aq Pa form.h
automatically includes both
.Aq Pa curses.h
and
.Aq Pa eti.h .
The option
.Dv O_REFORMAT
is a
.Nx
extension and must not be used in portable code.