1 .\" $NetBSD: forms.3,v 1.16 2004/11/24 12:09:13 wiz Exp $
4 .\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au
6 .\" This code is donated to The NetBSD Foundation by the author.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. The name of the Author may not be used to endorse or promote
17 .\" products derived from this software without specific prior written
20 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 library provides a terminal independent form system using the
50 functions the terminal must be set up by
57 functions must be linked with the
64 library provides facilities for defining form fields, placing a form on the
65 terminal screen, assign pre and post change operations and setting the
66 attributes of both the form and its fields.
67 .Ss Defining default attributes for forms and fields
70 library allows any settable attribute or option of both the form and field
71 objects to be defined such that any new form or field automatically inherits
73 Setting the default value will not affect any field or
74 form that has already been created but will be applied to subsequent objects.
75 To set the default attribute or option the set routine is passed a
77 pointer in the field or form parameter when calling the set routine.
78 The current default value can be retrieved by calling the get routine with a
80 pointer for the field or form parameter.
82 .Bl -column set_fieldtype_choiceXX
83 .It Sy "Form Routine Name" Ta Sy "Manual Page Name"
84 .It current_field Ta Xr form_page 3
85 .It data_ahead Ta Xr form_data 3
86 .It data_behind Ta Xr form_data 3
87 .It dup_field Ta Xr form_field_new 3
88 .It dynamic_field_info Ta Xr form_field_info 3
89 .It field_arg Ta Xr form_field_validation 3
90 .It field_back Ta Xr form_field_attributes 3
91 .It field_buffer Ta Xr form_field_buffer 3
92 .It field_count Ta Xr form_field 3
93 .It field_fore Ta Xr form_field_attributes 3
94 .It field_index Ta Xr form_page 3
95 .It field_info Ta Xr form_field_info 3
96 .It field_init Ta Xr form_hook 3
97 .It field_just Ta Xr form_field_just 3
98 .It field_opts Ta Xr form_field_opts 3
99 .It field_opts_off Ta Xr form_field_opts 3
100 .It field_opts_on Ta Xr form_field_opts 3
101 .It field_pad Ta Xr form_field_attributes 3
102 .It field_status Ta Xr form_field_buffer 3
103 .It field_term Ta Xr form_hook 3
104 .It field_type Ta Xr form_field_validation 3
105 .It field_userptr Ta Xr form_field_userptr 3
106 .It form_driver Ta Xr form_driver 3
107 .It form_fields Ta Xr form_field 3
108 .It form_init Ta Xr form_hook 3
109 .It form_max_page Ta Xr form_page 3
110 .It form_opts Ta Xr form_opts 3
111 .It form_opts_off Ta Xr form_opts 3
112 .It form_opts_on Ta Xr form_opts 3
113 .It form_page Ta Xr form_page 3
114 .It form_sub Ta Xr form_win 3
115 .It form_term Ta Xr form_hook 3
116 .It form_userptr Ta Xr form_userptr 3
117 .It form_win Ta Xr form_win 3
118 .It free_field Ta Xr form_field_new 3
119 .It free_fieldtype Ta Xr form_fieldtype 3
120 .It free_form Ta Xr form_new 3
121 .It link_field Ta Xr form_field_new 3
122 .It link_fieldtype Ta Xr form_fieldtype 3
123 .It move_field Ta Xr form_field 3
124 .It new_field Ta Xr form_field_new 3
125 .It new_fieldtype Ta Xr form_fieldtype 3
126 .It new_form Ta Xr form_new 3
127 .It new_page Ta Xr form_new_page 3
128 .It pos_form_cursor Ta Xr form_cursor 3
129 .It post_form Ta Xr form_post 3
130 .It scale_form Ta Xr form_win 3
131 .It set_current_field Ta Xr form_page 3
132 .It set_field_back Ta Xr form_field_attributes 3
133 .It set_field_buffer Ta Xr form_field_buffer 3
134 .It set_field_fore Ta Xr form_field_attributes 3
135 .It set_field_init Ta Xr form_hook 3
136 .It set_field_just Ta Xr form_field_just 3
137 .It set_field_opts Ta Xr form_field_opts 3
138 .It set_field_pad Ta Xr form_field_attributes 3
139 .It set_field_printf Ta Xr form_field_buffer 3
140 .It set_field_status Ta Xr form_field_buffer 3
141 .It set_field_term Ta Xr form_hook 3
142 .It set_field_type Ta Xr form_field_validation 3
143 .It set_field_userptr Ta Xr form_field_userptr 3
144 .It set_fieldtype_arg Ta Xr form_fieldtype 3
145 .It set_fieldtype_choice Ta Xr form_fieldtype 3
146 .It set_form_fields Ta Xr form_field 3
147 .It set_form_init Ta Xr form_hook 3
148 .It set_form_opts Ta Xr form_opts 3
149 .It set_form_page Ta Xr form_page 3
150 .It set_form_sub Ta Xr form_win 3
151 .It set_form_term Ta Xr form_hook 3
152 .It set_form_userptr Ta Xr form_userptr 3
153 .It set_form_win Ta Xr form_win 3
154 .It set_max_field Ta Xr form_field_buffer 3
155 .It set_new_page Ta Xr form_new_page 3
156 .It unpost_form Ta Xr form_post 3
159 Any function returning a string pointer will return
162 Functions returning an integer will return one of the following:
163 .Bl -column set_fieldtype_choiceXX
164 .It Dv E_OK Ta No The function was successful.
165 .It Dv E_SYSTEM_ERROR Ta No There was a system error during the call.
166 .It Dv E_BAD_ARGUMENT Ta No One or more of the arguments passed to \
167 the function was incorrect.
168 .It Dv E_POSTED Ta No The form is already posted.
169 .It Dv E_CONNECTED Ta No A field was already connected to a form.
170 .It Dv E_BAD_STATE Ta No The function was called from within an \
171 initialization or termination routine.
172 .It Dv E_NO_ROOM Ta No The form does not fit within the subwindow.
173 .It Dv E_NOT_POSTED Ta No The form is not posted.
174 .It Dv E_UNKNOWN_COMMAND Ta No The form driver does not recognize the \
175 request passed to it.
176 .It Dv E_NOT_SELECTABLE Ta No The field could not be selected.
177 .It Dv E_NOT_CONNECTED Ta No The field is not connected to a form.
178 .It Dv E_REQUEST_DENIED Ta No The form driver could not process the request.
179 .It Dv E_INVALID_FIELD Ta No The field is invalid.
180 .It Dv E_CURRENT Ta No The field is the active one on the form.
186 This implementation of the forms library does depart in behavior
187 subtly from the original AT\*[Am]T implementation.
188 Some of the more notable departures are:
190 .Bl -tag -width "The TAB character" -compact
192 For multi-line fields the data will be wrapped as it is entered, this
193 does not happen in the AT\*[Am]T implementation.
195 In this implementation, the contents of buffer 0 are always current
196 regardless of whether the field has been validated or not.
198 In the AT\*[Am]T implementation fields are circular on a page, that is, a
199 next field from the last field will go to the first field on the
201 In this implementation a next field request on the last
202 field of a page will result in the forms library positioning the
203 cursor on the first field of the next page.
204 If the field is the last
205 field in the form then going to the next field will be denied, in the
206 AT\*[Am]T it would result in the cursor being placed on the first field of
209 In this implementation only the data entered by the user in the form
210 field will be returned, unlike the AT\*[Am]T library which would return the
211 contents of the field padded to the size of the field with the pad
213 .It The TAB character
214 The handling of the TAB character in fields varies between
216 In ncurses attempting to set a field contents with a
217 string containing a TAB will result in an error and will not allow a
218 TAB to be entered into a field.
219 The AT\*[Am]T library statically
220 converts tabs to the equivalent number of spaces when the field buffer
221 is set but the form driver will not allow a TAB to be inserted into
223 This implementation allows TAB when setting the
224 field buffer and also will allow TAB to be inserted into a field
225 buffer via the form driver and correctly calculates the cursor
226 position allowing for expansion of the TAB character.
230 extension and must not be used in portable code.
232 This field option is a
234 extension and must not be used in portable code.