1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2010,2015 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.25 2015/12/05 21:06:26 tom Exp $
36 \fBform_driver_w\fR \- command-processing loop of the form system
38 \fB#include <form.h>\fR
40 \fBint form_driver(FORM *\fP\fIform\fP\fB, int \fP\fIc\fP\fB);\fP
42 \fBint form_driver_w(FORM *\fP\fIform\fP\fB, int \fP\fIc\fP\fB, wchar_t \fP\fIwch\fP\fB);\fP
46 Once a form has been posted (displayed), you should funnel input events to it
47 through \fBform_driver\fR. This routine has three major input cases:
49 The input is a form navigation request.
50 Navigation request codes are constants defined in \fB<form.h>\fP,
51 which are distinct from the key- and character codes returned by \fBwgetch\fP(3X).
53 The input is a printable character.
54 Printable characters (which must be positive, less than 256) are
55 checked according to the program's locale settings.
57 The input is the KEY_MOUSE special key associated with an mouse event.
60 This extension simplifies the use of the forms library using wide characters.
61 The input is either a key code (a request) or a wide character
62 returned by \fBget_wch\fP(3X).
63 The type must be passed as well,
64 to enable the library to determine whether the parameter
65 is a wide character or a request.
66 .SS Form-driver requests
68 The form driver requests are as follows:
73 \fIName\fR \fIDescription\fR
74 REQ_BEG_FIELD Move to the beginning of the field.
75 REQ_BEG_LINE Move to the beginning of the line.
76 REQ_CLR_EOF Clear to end of field from cursor.
77 REQ_CLR_EOL Clear to end of line from cursor.
78 REQ_CLR_FIELD Clear the entire field.
79 REQ_DEL_CHAR Delete character at the cursor.
80 REQ_DEL_LINE Delete line at the cursor.
81 REQ_DEL_PREV Delete character before the cursor.
82 REQ_DEL_WORD Delete blank-delimited word at the cursor.
83 REQ_DOWN_CHAR Move down in the field.
84 REQ_DOWN_FIELD Move down to a field.
85 REQ_END_FIELD Move to the end of the field.
86 REQ_END_LINE Move to the end of the line.
87 REQ_FIRST_FIELD Move to the first field.
88 REQ_FIRST_PAGE Move to the first page.
89 REQ_INS_CHAR Insert a blank at the cursor.
90 REQ_INS_LINE Insert a blank line at the cursor.
91 REQ_INS_MODE Enter insert mode.
92 REQ_LAST_FIELD Move to the last field.
93 REQ_LAST_PAGE Move to the last field.
94 REQ_LEFT_CHAR Move left in the field.
95 REQ_LEFT_FIELD Move left to a field.
96 REQ_NEW_LINE Insert or overlay a new line.
97 REQ_NEXT_CHAR Move to the next char.
98 REQ_NEXT_CHOICE Display next field choice.
99 REQ_NEXT_FIELD Move to the next field.
100 REQ_NEXT_LINE Move to the next line.
101 REQ_NEXT_PAGE Move to the next page.
102 REQ_NEXT_PAGE Move to the next page.
103 REQ_NEXT_WORD Move to the next word.
104 REQ_OVL_MODE Enter overlay mode.
105 REQ_PREV_CHAR Move to the previous char.
106 REQ_PREV_CHOICE Display previous field choice.
107 REQ_PREV_FIELD Move to the previous field.
108 REQ_PREV_LINE Move to the previous line.
109 REQ_PREV_PAGE Move to the previous page.
110 REQ_PREV_WORD Move to the previous word.
111 REQ_RIGHT_CHAR Move right in the field.
112 REQ_RIGHT_FIELD Move right to a field.
113 REQ_SCR_BCHAR Scroll the field backward a character.
114 REQ_SCR_BHPAGE Scroll the field backward half a page.
115 REQ_SCR_BLINE Scroll the field backward a line.
116 REQ_SCR_BPAGE Scroll the field backward a page.
117 REQ_SCR_FCHAR Scroll the field forward a character.
118 REQ_SCR_FHPAGE Scroll the field forward half a page.
119 REQ_SCR_FLINE Scroll the field forward a line.
120 REQ_SCR_FPAGE Scroll the field forward a page.
121 REQ_SCR_HBHALF Horizontal scroll the field backward half a line.
122 REQ_SCR_HBLINE Horizontal scroll the field backward a line.
123 REQ_SCR_HFHALF Horizontal scroll the field forward half a line.
124 REQ_SCR_HFLINE Horizontal scroll the field forward a line.
125 REQ_SFIRST_FIELD Move to the sorted first field.
126 REQ_SLAST_FIELD Move to the sorted last field.
127 REQ_SNEXT_FIELD Move to the sorted next field.
128 REQ_SPREV_FIELD Move to the sorted previous field.
129 REQ_UP_CHAR Move up in the field.
130 REQ_UP_FIELD Move up to a field.
131 REQ_VALIDATION Validate field.
134 If the second argument is a printable character, the driver places it
135 in the current position in the current field. If it is one of the forms
136 requests listed above, that request is executed.
139 If the second argument is the KEY_MOUSE special key, the associated
140 mouse event is translated into one of the above pre-defined requests.
141 Currently only clicks in the user window (e.g., inside the form display
142 area or the decoration window) are handled.
144 If you click above the display region of the form:
147 a REQ_PREV_FIELD is generated for a single click,
149 a REQ_PREV_PAGE is generated for a double-click and
151 a REQ_FIRST_FIELD is generated for a triple-click.
154 If you click below the display region of the form:
157 a REQ_NEXT_FIELD is generated for a single click,
159 a REQ_NEXT_PAGE is generated for a double-click and
161 a REQ_LAST_FIELD is generated for a triple-click.
164 If you click at an field inside the display area of the form:
167 the form cursor is positioned to that field.
169 If you double-click a field,
170 the form cursor is positioned to that field
171 and \fBE_UNKNOWN_COMMAND\fR is returned.
172 This return value makes sense,
173 because a double click usually means that an field-specific action should
175 It is exactly the purpose of this return value to signal that an
176 application specific command should be executed.
179 into a request was done, \fBform_driver\fR returns the result of this request.
182 If you clicked outside the user window or the mouse event could not be translated
183 into a form request an \fBE_REQUEST_DENIED\fR is returned.
184 .SS Application-defined commands
186 If the second argument is neither printable nor one of the above
187 pre-defined form requests, the driver assumes it is an application-specific
188 command and returns \fBE_UNKNOWN_COMMAND\fR. Application-defined commands
189 should be defined relative to \fBMAX_COMMAND\fR, the maximum value of these
190 pre-defined requests.
192 \fBform_driver\fR returns one of the following error codes:
195 The routine succeeded.
198 Routine detected an incorrect or out-of-range argument.
201 Routine was called from an initialization or termination function.
204 The form has not been posted.
207 Contents of field is invalid.
210 The form driver could not process the request.
213 System error occurred (see \fBerrno\fR).
216 The form driver code saw an unknown request code.
221 \fBform_variables\fR(3X),
224 The header file \fB<form.h>\fR automatically includes the header files
227 These routines emulate the System V forms library. They were not supported on
228 Version 7 or BSD versions.
230 Juergen Pfeifer. Manual pages and adaptation for new curses by Eric