1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
3 ****************************************************************************
4 * Copyright (c) 1998-2008,2010 Free Software Foundation, Inc. *
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: *
14 * The above copyright notice and this permission notice shall be included *
15 * in all copies or substantial portions of the Software. *
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. *
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 *
29 ****************************************************************************
30 * @Id: form_driver.3x,v 1.22 2010/12/04 18:38:55 tom Exp @
34 <TITLE>form_driver 3x</TITLE>
35 <link rev=made href="mailto:bug-ncurses@gnu.org">
36 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
39 <H1>form_driver 3x</H1>
42 <!-- Manpage converted by man2html 3.0.1 -->
43 <STRONG><A HREF="form_driver.3x.html">form_driver(3x)</A></STRONG> <STRONG><A HREF="form_driver.3x.html">form_driver(3x)</A></STRONG>
50 <STRONG>form_driver</STRONG> - command-processing loop of the form system
54 <H2>SYNOPSIS</H2><PRE>
55 <STRONG>#include</STRONG> <STRONG><form.h></STRONG>
56 int form_driver(FORM *form, int c);
60 <H2>DESCRIPTION</H2><PRE>
61 Once a form has been posted (displayed), you should funnel
62 input events to it through <STRONG>form_driver</STRONG>. This routine has
63 three major input cases:
65 <STRONG>o</STRONG> The input is a form navigation request. Navigation
66 request codes are constants defined in <STRONG><form.h></STRONG>, which
67 are distinct from the key- and character codes
68 returned by <STRONG>wgetch</STRONG>.
70 <STRONG>o</STRONG> The input is a printable character. Printable charac-
71 ters (which must be positive, less than 256) are
72 checked according to the program's locale settings.
74 <STRONG>o</STRONG> The input is the KEY_MOUSE special key associated with
77 The form driver requests are as follows:
80 Move to the next page.
83 Move to the previous page.
86 Move to the first page.
89 Move to the last field.
93 Move to the next field.
96 Move to the previous field.
99 Move to the first field.
102 Move to the last field.
105 Move to the sorted next field.
108 Move to the sorted previous field.
111 Move to the sorted first field.
114 Move to the sorted last field.
117 Move left to a field.
120 Move right to a field.
126 Move down to a field.
130 Move to the next char.
133 Move to the previous char.
136 Move to the next line.
139 Move to the previous line.
142 Move to the next word.
145 Move to the previous word.
148 Move to the beginning of the field.
151 Move to the end of the field.
154 Move to the beginning of the line.
157 Move to the end of the line.
160 Move left in the field.
163 Move right in the field.
166 Move up in the field.
169 Move down in the field.
173 Insert or overlay a new line.
176 Insert a blank at the cursor.
179 Insert a blank line at the cursor.
182 Delete character at the cursor.
185 Delete character before the cursor.
188 Delete line at the cursor.
191 Delete blank-delimited word at the cursor.
194 Clear to end of line from cursor.
197 Clear to end of field from cursor.
200 Clear the entire field.
210 Scroll the field forward a line.
213 Scroll the field backward a line.
216 Scroll the field forward a page.
219 Scroll the field backward a page.
222 Scroll the field forward half a page.
225 Scroll the field backward half a page.
229 Scroll the field forward a character.
232 Scroll the field backward a character.
235 Horizontal scroll the field forward a line.
238 Horizontal scroll the field backward a line.
241 Horizontal scroll the field forward half a line.
244 Horizontal scroll the field backward half a line.
251 Display next field choice.
254 Display previous field choice.
256 If the second argument is a printable character, the
257 driver places it in the current position in the current
258 field. If it is one of the forms requests listed above,
259 that request is executed.
261 <STRONG>MOUSE</STRONG> <STRONG>HANDLING</STRONG>
262 If the second argument is the KEY_MOUSE special key, the
263 associated mouse event is translated into one of the above
264 pre-defined requests. Currently only clicks in the user
265 window (e.g., inside the form display area or the decora-
266 tion window) are handled.
268 If you click above the display region of the form:
270 a REQ_PREV_FIELD is generated for a single click,
272 a REQ_PREV_PAGE is generated for a double-click and
274 a REQ_FIRST_FIELD is generated for a triple-click.
276 If you click below the display region of the form:
278 a REQ_NEXT_FIELD is generated for a single click,
280 a REQ_NEXT_PAGE is generated for a double-click and
282 a REQ_LAST_FIELD is generated for a triple-click.
284 If you click at an field inside the display area of the
287 <STRONG>o</STRONG> the form cursor is positioned to that field.
289 <STRONG>o</STRONG> If you double-click a field, the form cursor is
290 positioned to that field and <STRONG>E_UNKNOWN_COMMAND</STRONG> is
291 returned. This return value makes sense, because a
292 double click usually means that an field-specific
293 action should be returned. It is exactly the pur-
294 pose of this return value to signal that an appli-
295 cation specific command should be executed.
297 <STRONG>o</STRONG> If a translation into a request was done,
298 <STRONG>form_driver</STRONG> returns the result of this request.
300 If you clicked outside the user window or the mouse event
301 could not be translated into a form request an
302 <STRONG>E_REQUEST_DENIED</STRONG> is returned.
304 <STRONG>APPLICATION-DEFINED</STRONG> <STRONG>COMMANDS</STRONG>
305 If the second argument is neither printable nor one of the
306 above pre-defined form requests, the driver assumes it is
307 an application-specific command and returns <STRONG>E_UNKNOWN_COM-</STRONG>
308 <STRONG>MAND</STRONG>. Application-defined commands should be defined rel-
309 ative to <STRONG>MAX_COMMAND</STRONG>, the maximum value of these pre-
314 <H2>RETURN VALUE</H2><PRE>
315 <STRONG>form_driver</STRONG> returns one of the following error codes:
317 <STRONG>E_OK</STRONG> The routine succeeded.
319 <STRONG>E_BAD_ARGUMENT</STRONG>
320 Routine detected an incorrect or out-of-range argu-
323 <STRONG>E_BAD_STATE</STRONG>
324 Routine was called from an initialization or termina-
327 <STRONG>E_NOT_POSTED</STRONG>
328 The form has not been posted.
330 <STRONG>E_INVALID_FIELD</STRONG>
331 Contents of field is invalid.
333 <STRONG>E_REQUEST_DENIED</STRONG>
334 The form driver could not process the request.
336 <STRONG>E_SYSTEM_ERROR</STRONG>
337 System error occurred (see <STRONG>errno</STRONG>).
339 <STRONG>E_UNKNOWN_COMMAND</STRONG>
340 The form driver code saw an unknown request code.
344 <H2>SEE ALSO</H2><PRE>
345 <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="form.3x.html">form(3x)</A></STRONG>, <STRONG><A HREF="form_variables.3x.html">form_variables(3x)</A></STRONG>, <STRONG><A HREF="getch.3x.html">getch(3x)</A></STRONG>.
350 The header file <STRONG><form.h></STRONG> automatically includes the header
351 files <STRONG><curses.h></STRONG>.
355 <H2>PORTABILITY</H2><PRE>
356 These routines emulate the System V forms library. They
357 were not supported on Version 7 or BSD versions.
361 <H2>AUTHORS</H2><PRE>
362 Juergen Pfeifer. Manual pages and adaptation for new
363 curses by Eric S. Raymond.
367 <STRONG><A HREF="form_driver.3x.html">form_driver(3x)</A></STRONG>
371 Man(1) output converted with
372 <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>