1form_driver(3X) form_driver(3X)
2
3
4
6 form_driver - command-processing loop of the form system
7
9 #include <form.h>
10 int form_driver(FORM *form, int c);
11
13 Once a form has been posted (displayed), you should funnel input events
14 to it through form_driver. This routine has two major input cases;
15 either the input is a form navigation request or it is a printable
16 ASCII character. The form driver requests are as follows:
17
18 REQ_NEXT_PAGE
19 Move to the next page.
20
21 REQ_PREV_PAGE
22 Move to the previous page.
23
24 REQ_FIRST_PAGE
25 Move to the first page.
26
27 REQ_LAST_PAGE
28 Move to the last field.
29
30
31 REQ_NEXT_FIELD
32 Move to the next field.
33
34 REQ_PREV_FIELD
35 Move to the previous field.
36
37 REQ_FIRST_FIELD
38 Move to the first field.
39
40 REQ_LAST_FIELD
41 Move to the last field.
42
43 REQ_SNEXT_FIELD
44 Move to the sorted next field.
45
46 REQ_SPREV_FIELD
47 Move to the sorted previous field.
48
49 REQ_SFIRST_FIELD
50 Move to the sorted first field.
51
52 REQ_SLAST_FIELD
53 Move to the sorted last field.
54
55 REQ_LEFT_FIELD
56 Move left to a field.
57
58 REQ_RIGHT_FIELD
59 Move right to a field.
60
61 REQ_UP_FIELD
62 Move up to a field.
63
64 REQ_DOWN_FIELD
65 Move down to a field.
66
67
68 REQ_NEXT_CHAR
69 Move to the next char.
70
71 REQ_PREV_CHAR
72 Move to the previous char.
73
74 REQ_NEXT_LINE
75 Move to the next line.
76
77 REQ_PREV_LINE
78 Move to the previous line.
79
80 REQ_NEXT_WORD
81 Move to the next word.
82
83 REQ_PREV_WORD
84 Move to the previous word.
85
86 REQ_BEG_FIELD
87 Move to the beginning of the field.
88
89 REQ_END_FIELD
90 Move to the end of the field.
91
92 REQ_BEG_LINE
93 Move to the beginning of the line.
94
95 REQ_END_LINE
96 Move to the end of the line.
97
98 REQ_LEFT_CHAR
99 Move left in the field.
100
101 REQ_RIGHT_CHAR
102 Move right in the field.
103
104 REQ_UP_CHAR
105 Move up in the field.
106
107 REQ_DOWN_CHAR
108 Move down in the field.
109
110
111 REQ_NEW_LINE
112 Insert or overlay a new line.
113
114 REQ_INS_CHAR
115 Insert a blank at the cursor.
116
117 REQ_INS_LINE
118 Insert a blank line at the cursor.
119
120 REQ_DEL_CHAR
121 Delete character at the cursor.
122
123 REQ_DEL_PREV
124 Delete character before the cursor.
125
126 REQ_DEL_LINE
127 Delete line at the cursor.
128
129 REQ_DEL_WORD
130 Delete blank-delimited word at the cursor.
131
132 REQ_CLR_EOL
133 Clear to end of line from cursor.
134
135 REQ_CLR_EOF
136 Clear to end of field from cursor.
137
138 REQ_CLR_FIELD
139 Clear the entire field.
140
141 REQ_OVL_MODE
142 Enter overlay mode.
143
144 REQ_INS_MODE
145 Enter insert mode.
146
147
148 REQ_SCR_FLINE
149 Scroll the field forward a line.
150
151 REQ_SCR_BLINE
152 Scroll the field backward a line.
153
154 REQ_SCR_FPAGE
155 Scroll the field forward a page.
156
157 REQ_SCR_BPAGE
158 Scroll the field backward a page.
159
160 REQ_SCR_FHPAGE
161 Scroll the field forward half a page.
162
163 REQ_SCR_BHPAGE
164 Scroll the field backward half a page.
165
166
167 REQ_SCR_FCHAR
168 Scroll the field forward a character.
169
170 REQ_SCR_BCHAR
171 Scroll the field backward a character.
172
173 REQ_SCR_HFLINE
174 Horizontal scroll the field forward a line.
175
176 REQ_SCR_HBLINE
177 Horizontal scroll the field backward a line.
178
179 REQ_SCR_HFHALF
180 Horizontal scroll the field forward half a line.
181
182 REQ_SCR_HBHALF
183 Horizontal scroll the field backward half a line.
184
185
186 REQ_VALIDATION
187 Validate field.
188
189 REQ_NEXT_CHOICE
190 Display next field choice.
191
192 REQ_PREV_CHOICE
193 Display previous field choice.
194
195 If the second argument is a printable ASCII character, the driver
196 places it in the current position in the current field. If it is one
197 of the forms requests listed above, that request is executed.
198
199 MOUSE HANDLING
200 If the second argument is the KEY_MOUSE special key, the associated
201 mouse event is translated into one of the above pre-defined requests.
202 Currently only clicks in the user window (e.g. inside the form display
203 area or the decoration window) are handled.
204
205 If you click above the display region of the form:
206
207 a REQ_PREV_FIELD is generated for a single click,
208
209 a REQ_PREV_PAGE is generated for a double-click and
210
211 a REQ_FIRST_FIELD is generated for a triple-click.
212
213 If you click below the display region of the form:
214
215 a REQ_NEXT_FIELD is generated for a single click,
216
217 a REQ_NEXT_PAGE is generated for a double-click and
218
219 a REQ_LAST_FIELD is generated for a triple-click.
220
221 If you click at an field inside the display area of the form:
222
223 - the form cursor is positioned to that field.
224
225 - If you double-click a field, the form cursor is positioned to
226 that field and E_UNKNOWN_COMMAND is returned. This return
227 value makes sense, because a double click usually means that
228 an field-specific action should be returned. It is exactly
229 the purpose of this return value to signal that an applica‐
230 tion specific command should be executed.
231
232 - If a translation into a request was done, form_driver returns
233 the result of this request.
234
235 If you clicked outside the user window or the mouse event couldn't be
236 translated into a form request an E_REQUEST_DENIED is returned.
237
238 APPLICATION-DEFINED COMMANDS
239 If the second argument is neither printable ASCII nor one of the above
240 pre-defined form requests, the driver assumes it is an application-spe‐
241 cific command and returns E_UNKNOWN_COMMAND. Application-defined com‐
242 mands should be defined relative to MAX_COMMAND, the maximum value of
243 these pre-defined requests.
244
246 form_driver returns one of the following error codes:
247
248 E_OK The routine succeeded.
249
250 E_BAD_ARGUMENT
251 Routine detected an incorrect or out-of-range argument.
252
253 E_BAD_STATE
254 Routine was called from an initialization or termination function.
255
256 E_NOT_POSTED
257 The form has not been posted.
258
259 E_INVALID_FIELD
260 Contents of field is invalid.
261
262 E_REQUEST_DENIED
263 The form driver could not process the request.
264
265 E_SYSTEM_ERROR
266 System error occurred (see errno).
267
268 E_UNKNOWN_COMMAND
269 The form driver code saw an unknown request code.
270
272 curses(3X), form(3X).
273
275 The header file <form.h> automatically includes the header files
276 <curses.h>.
277
279 These routines emulate the System V forms library. They were not sup‐
280 ported on Version 7 or BSD versions.
281
283 Juergen Pfeifer. Manual pages and adaptation for new curses by Eric S.
284 Raymond.
285
286
287
288 form_driver(3X)