blob: 2f8f884861fae16e5689a2107b94dddc93fea567 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301'\" t
2.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04003.\" Copyright 2018-2023,2024 Thomas E. Dickey *
4.\" Copyright 1998-2016,2017 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05305.\" *
6.\" Permission is hereby granted, free of charge, to any person obtaining a *
7.\" copy of this software and associated documentation files (the *
8.\" "Software"), to deal in the Software without restriction, including *
9.\" without limitation the rights to use, copy, modify, merge, publish, *
10.\" distribute, distribute with modifications, sublicense, and/or sell *
11.\" copies of the Software, and to permit persons to whom the Software is *
12.\" furnished to do so, subject to the following conditions: *
13.\" *
14.\" The above copyright notice and this permission notice shall be included *
15.\" in all copies or substantial portions of the Software. *
16.\" *
17.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
18.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
19.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
20.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
21.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
22.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
23.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24.\" *
25.\" Except as contained in this notice, the name(s) of the above copyright *
26.\" holders shall not be used in advertising or otherwise to promote the *
27.\" sale, use or other dealings in this Software without prior written *
28.\" authorization. *
29.\"***************************************************************************
30.\"
micky3879b9f5e72025-07-08 18:04:53 -040031.\" $Id: form.3x,v 1.54 2024/03/16 15:35:01 tom Exp $
32.TH form 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
33.ie \n(.g \{\
34.ds `` \(lq
35.ds '' \(rq
36.\}
37.el \{\
38.ie t .ds `` ``
39.el .ds `` ""
40.ie t .ds '' ''
41.el .ds '' ""
42.\}
43.
44.de bP
45.ie n .IP \(bu 4
46.el .IP \(bu 2
47..
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053048.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040049\fBform\fP \-
50curses extension for programming forms
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053051.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040052.nf
53\fB#include <form.h>
54.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053055.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040056The \fBform\fP library provides terminal-independent facilities for composing
57form screens on character-cell terminals.
58The library includes: field
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053059routines, which create and modify form fields; and form routines, which group
60fields into forms, display forms on the screen, and handle interaction with the
61user.
62.PP
micky3879b9f5e72025-07-08 18:04:53 -040063The \fBform\fP library uses the \fBcurses\fP libraries.
64To use the \fBform\fP library, link with the options
65\fB\-lform \-lcurses\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053066.PP
67Your program should set up the locale, e.g.,
68.sp
69 \fBsetlocale(LC_ALL, "");\fP
70.sp
71so that input/output processing will work.
72.PP
micky3879b9f5e72025-07-08 18:04:53 -040073A curses initialization routine such as \fBinitscr\fP must be called
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053074before using any of these functions.
75.
micky3879b9f5e72025-07-08 18:04:53 -040076.SS "Current Default Values for Field Attributes"
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053077.
micky3879b9f5e72025-07-08 18:04:53 -040078The \fBform\fP library maintains a default value for field attributes.
79You
80can get or set this default by calling the appropriate \fBset_\fP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053081or retrieval
micky3879b9f5e72025-07-08 18:04:53 -040082routine with a \fBNULL\fP field pointer.
83Changing this default with a
84\fBset_\fP function affects future field creations, but does not change the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053085rendering of fields already created.
86.
micky3879b9f5e72025-07-08 18:04:53 -040087.SS "Routine Name Index"
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053088.
micky3879b9f5e72025-07-08 18:04:53 -040089The following table lists each \fBform\fP routine and the name of
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053090the manual page on which it is described.
micky3879b9f5e72025-07-08 18:04:53 -040091Routines flagged with \*(``*\*(''
92are \fI\%ncurses\fP-specific, not present in SVr4.
93.PP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053094.TS
95l l
96l l .
micky3879b9f5e72025-07-08 18:04:53 -040097\fBcurses\fP Routine Name Manual Page Name
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053098=
micky3879b9f5e72025-07-08 18:04:53 -040099current_field \fBform_page\fP(3X)
100data_ahead \fBform_data\fP(3X)
101data_behind \fBform_data\fP(3X)
102dup_field \fBform_field_new\fP(3X)
103dynamic_field_info \fBform_field_info\fP(3X)
104field_arg \fBform_field_validation\fP(3X)
105field_back \fBform_field_attributes\fP(3X)
106field_buffer \fBform_field_buffer\fP(3X)
107field_count \fBform_field\fP(3X)
108field_fore \fBform_field_attributes\fP(3X)
109field_index \fBform_page\fP(3X)
110field_info \fBform_field_info\fP(3X)
111field_init \fBform_hook\fP(3X)
112field_just \fBform_field_just\fP(3X)
113field_opts \fBform_field_opts\fP(3X)
114field_opts_off \fBform_field_opts\fP(3X)
115field_opts_on \fBform_field_opts\fP(3X)
116field_pad \fBform_field_attributes\fP(3X)
117field_status \fBform_field_buffer\fP(3X)
118field_term \fBform_hook\fP(3X)
119field_type \fBform_field_validation\fP(3X)
120field_userptr \fBform_field_userptr\fP(3X)
121form_driver \fBform_driver\fP(3X)
122form_driver_w \fBform_driver\fP(3X)*
123form_fields \fBform_field\fP(3X)
124form_init \fBform_hook\fP(3X)
125form_opts \fBform_opts\fP(3X)
126form_opts_off \fBform_opts\fP(3X)
127form_opts_on \fBform_opts\fP(3X)
128form_page \fBform_page\fP(3X)
129form_request_by_name \fBform_requestname\fP(3X)*
130form_request_name \fBform_requestname\fP(3X)*
131form_sub \fBform_win\fP(3X)
132form_term \fBform_hook\fP(3X)
133form_userptr \fBform_userptr\fP(3X)
134form_win \fBform_win\fP(3X)
135free_field \fBform_field_new\fP(3X)
136free_fieldtype \fBform_fieldtype\fP(3X)
137free_form \fBform_new\fP(3X)
138link_field \fBform_field_new\fP(3X)
139link_fieldtype \fBform_fieldtype\fP(3X)
140move_field \fBform_field\fP(3X)
141new_field \fBform_field_new\fP(3X)
142new_fieldtype \fBform_fieldtype\fP(3X)
143new_form \fBform_new\fP(3X)
144new_page \fBform_new_page\fP(3X)
145pos_form_cursor \fBform_cursor\fP(3X)
146post_form \fBform_post\fP(3X)
147scale_form \fBform_win\fP(3X)
148set_current_field \fBform_page\fP(3X)
149set_field_back \fBform_field_attributes\fP(3X)
150set_field_buffer \fBform_field_buffer\fP(3X)
151set_field_fore \fBform_field_attributes\fP(3X)
152set_field_init \fBform_hook\fP(3X)
153set_field_just \fBform_field_just\fP(3X)
154set_field_opts \fBform_field_opts\fP(3X)
155set_field_pad \fBform_field_attributes\fP(3X)
156set_field_status \fBform_field_buffer\fP(3X)
157set_field_term \fBform_hook\fP(3X)
158set_field_type \fBform_field_validation\fP(3X)
159set_field_userptr \fBform_field_userptr\fP(3X)
160set_fieldtype_arg \fBform_fieldtype\fP(3X)
161set_fieldtype_choice \fBform_fieldtype\fP(3X)
162set_form_fields \fBform_field\fP(3X)
163set_form_init \fBform_hook\fP(3X)
164set_form_opts \fBform_field_opts\fP(3X)
165set_form_page \fBform_page\fP(3X)
166set_form_sub \fBform_win\fP(3X)
167set_form_term \fBform_hook\fP(3X)
168set_form_userptr \fBform_userptr\fP(3X)
169set_form_win \fBform_win\fP(3X)
170set_max_field \fBform_field_buffer\fP(3X)
171set_new_page \fBform_new_page\fP(3X)
172unfocus_current_field \fBform_page\fP(3X)*
173unpost_form \fBform_post\fP(3X)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530174.TE
175.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -0400176Routines that return pointers return \fBNULL\fP on error,
177and set \fBerrno\fP to the corresponding error-code returned by functions
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530178returning an integer.
179Routines that return
180an integer return one of the following error codes:
181.TP 5
182.B E_OK
183The routine succeeded.
184.TP 5
185.B E_BAD_ARGUMENT
186Routine detected an incorrect or out-of-range argument.
187.TP 5
188.B E_BAD_STATE
189Routine was called from an initialization or termination function.
190.TP 5
191.B E_CONNECTED
192The field is already connected to a form.
193.TP 5
194.B E_INVALID_FIELD
195Contents of a field are not valid.
196.TP 5
197.B E_NOT_CONNECTED
198No fields are connected to the form.
199.TP 5
200.B E_NOT_POSTED
201The form has not been posted.
202.TP 5
203.B E_NO_ROOM
204Form is too large for its window.
205.TP 5
206.B E_POSTED
207The form is already posted.
208.TP 5
209.B E_REQUEST_DENIED
210The form driver could not process the request.
211.TP 5
212.B E_SYSTEM_ERROR
micky3879b9f5e72025-07-08 18:04:53 -0400213System error occurred (see \fBerrno\fP(3)).
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530214.TP 5
215.B E_UNKNOWN_COMMAND
216The form driver code saw an unknown request code.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530217.SH NOTES
micky3879b9f5e72025-07-08 18:04:53 -0400218The header file \fI\%form.h\fP itself includes \fI\%curses.h\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530219.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -0400220These routines emulate the System V forms library.
221They were not supported on
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530222Version 7 or BSD versions.
micky3879b9f5e72025-07-08 18:04:53 -0400223.PP
224A form facility was documented in SVr4.2's
225\fICharacter User Interface Programming\fP document.
226.PP
227It is not part of X/Open Curses.
228.PP
229Aside from \fI\%ncurses\fP, there are few implementations:
230.bP
231systems based on SVr4 source code, e.g., Solaris.
232.bP
233NetBSD curses.
234.PP
235A few functions in this implementation are extensions added for
236\fI\%ncurses\fP,
237but not provided by other implementations, e.g.,
238\fBform_driver_w\fP,
239\fBunfocus_current_field\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530240.SH AUTHORS
micky3879b9f5e72025-07-08 18:04:53 -0400241Juergen Pfeifer.
242Manual pages and adaptation for \fI\%ncurses\fP by Eric
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530243S. Raymond.
244.SH SEE ALSO
micky3879b9f5e72025-07-08 18:04:53 -0400245\fBcurses\fP(3X) and related pages whose names begin \*(``form_\*('' for
246detailed descriptions of the entry points.