1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a *
5 .\" copy of this software and associated documentation files (the *
6 .\" "Software"), to deal in the Software without restriction, including *
7 .\" without limitation the rights to use, copy, modify, merge, publish, *
8 .\" distribute, distribute with modifications, sublicense, and/or sell *
9 .\" copies of the Software, and to permit persons to whom the Software is *
10 .\" furnished to do so, subject to the following conditions: *
12 .\" The above copyright notice and this permission notice shall be included *
13 .\" in all copies or substantial portions of the Software. *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 .\" Except as contained in this notice, the name(s) of the above copyright *
24 .\" holders shall not be used in advertising or otherwise to promote the *
25 .\" sale, use or other dealings in this Software without prior written *
27 .\"***************************************************************************
29 .\" $Id: form_driver.3x,v 1.22 2010/12/04 18:38:55 tom Exp $
35 \fBform_driver\fR \- command-processing loop of the form system
37 \fB#include <form.h>\fR
39 int form_driver(FORM *form, int c);
42 Once a form has been posted (displayed), you should funnel input events to it
43 through \fBform_driver\fR. This routine has three major input cases:
45 The input is a form navigation request.
46 Navigation request codes are constants defined in \fB<form.h>\fP,
47 which are distinct from the key- and character codes returned by \fBwgetch\fP.
49 The input is a printable character.
50 Printable characters (which must be positive, less than 256) are
51 checked according to the program's locale settings.
53 The input is the KEY_MOUSE special key associated with an mouse event.
55 The form driver requests are as follows:
58 Move to the next page.
61 Move to the previous page.
64 Move to the first page.
67 Move to the last field.
71 Move to the next field.
74 Move to the previous field.
77 Move to the first field.
80 Move to the last field.
83 Move to the sorted next field.
86 Move to the sorted previous field.
89 Move to the sorted first field.
92 Move to the sorted last field.
98 Move right to a field.
104 Move down to a field.
108 Move to the next char.
111 Move to the previous char.
114 Move to the next line.
117 Move to the previous line.
120 Move to the next word.
123 Move to the previous word.
126 Move to the beginning of the field.
129 Move to the end of the field.
132 Move to the beginning of the line.
135 Move to the end of the line.
138 Move left in the field.
141 Move right in the field.
144 Move up in the field.
147 Move down in the field.
151 Insert or overlay a new line.
154 Insert a blank at the cursor.
157 Insert a blank line at the cursor.
160 Delete character at the cursor.
163 Delete character before the cursor.
166 Delete line at the cursor.
169 Delete blank-delimited word at the cursor.
172 Clear to end of line from cursor.
175 Clear to end of field from cursor.
178 Clear the entire field.
188 Scroll the field forward a line.
191 Scroll the field backward a line.
194 Scroll the field forward a page.
197 Scroll the field backward a page.
200 Scroll the field forward half a page.
203 Scroll the field backward half a page.
207 Scroll the field forward a character.
210 Scroll the field backward a character.
213 Horizontal scroll the field forward a line.
216 Horizontal scroll the field backward a line.
219 Horizontal scroll the field forward half a line.
222 Horizontal scroll the field backward half a line.
229 Display next field choice.
232 Display previous field choice.
234 If the second argument is a printable character, the driver places it
235 in the current position in the current field. If it is one of the forms
236 requests listed above, that request is executed.
239 If the second argument is the KEY_MOUSE special key, the associated
240 mouse event is translated into one of the above pre-defined requests.
241 Currently only clicks in the user window (e.g., inside the form display
242 area or the decoration window) are handled.
244 If you click above the display region of the form:
247 a REQ_PREV_FIELD is generated for a single click,
249 a REQ_PREV_PAGE is generated for a double-click and
251 a REQ_FIRST_FIELD is generated for a triple-click.
254 If you click below the display region of the form:
257 a REQ_NEXT_FIELD is generated for a single click,
259 a REQ_NEXT_PAGE is generated for a double-click and
261 a REQ_LAST_FIELD is generated for a triple-click.
264 If you click at an field inside the display area of the form:
267 the form cursor is positioned to that field.
269 If you double-click a field,
270 the form cursor is positioned to that field
271 and \fBE_UNKNOWN_COMMAND\fR is returned.
272 This return value makes sense,
273 because a double click usually means that an field-specific action should
275 It is exactly the purpose of this return value to signal that an
276 application specific command should be executed.
279 into a request was done, \fBform_driver\fR returns the result of this request.
282 If you clicked outside the user window or the mouse event could not be translated
283 into a form request an \fBE_REQUEST_DENIED\fR is returned.
284 .SS APPLICATION-DEFINED COMMANDS
286 If the second argument is neither printable nor one of the above
287 pre-defined form requests, the driver assumes it is an application-specific
288 command and returns \fBE_UNKNOWN_COMMAND\fR. Application-defined commands
289 should be defined relative to \fBMAX_COMMAND\fR, the maximum value of these
290 pre-defined requests.
292 \fBform_driver\fR returns one of the following error codes:
295 The routine succeeded.
298 Routine detected an incorrect or out-of-range argument.
301 Routine was called from an initialization or termination function.
304 The form has not been posted.
307 Contents of field is invalid.
310 The form driver could not process the request.
313 System error occurred (see \fBerrno\fR).
316 The form driver code saw an unknown request code.
321 \fBform_variables\fR(3X),
324 The header file \fB<form.h>\fR automatically includes the header files
327 These routines emulate the System V forms library. They were not supported on
328 Version 7 or BSD versions.
330 Juergen Pfeifer. Manual pages and adaptation for new curses by Eric