1form_driver(3X)                                                form_driver(3X)
2
3
4

NAME

6       form_driver, form_driver_w - command-processing loop of the form system
7

SYNOPSIS

9       #include <form.h>
10
11       int form_driver(FORM *form, int c);
12       int form_driver_w(FORM *form, int c, wchar_t wch);
13

DESCRIPTION

15   form_driver
16       Once a form has been posted (displayed), you should funnel input events
17       to it through form_driver.  This routine has three major input cases:
18
19       •   The input is a form navigation request.  Navigation  request  codes
20           are constants defined in <form.h>, which are distinct from the key-
21           and character codes returned by wgetch(3X).
22
23       •   The input is a printable character.   Printable  characters  (which
24           must  be positive, less than 256) are checked according to the pro‐
25           gram's locale settings.
26
27       •   The input is the KEY_MOUSE special key  associated  with  an  mouse
28           event.
29
30   form_driver_w
31       This extension simplifies the use of the forms library using wide char‐
32       acters.  The input is either a key code (a request) or a wide character
33       returned  by  get_wch(3X).   The type must be passed as well, to enable
34       the library to determine whether the parameter is a wide character or a
35       request.
36
37   Form-driver requests
38       The form driver requests are as follows:
39
40       Name               Description
41       ─────────────────────────────────────────────────────────────────────
42       REQ_BEG_FIELD      Move to the beginning of the field.
43       REQ_BEG_LINE       Move to the beginning of the line.
44       REQ_CLR_EOF        Clear to end of field from cursor.
45       REQ_CLR_EOL        Clear to end of line from cursor.
46       REQ_CLR_FIELD      Clear the entire field.
47       REQ_DEL_CHAR       Delete character at the cursor.
48       REQ_DEL_LINE       Delete line at the cursor.
49       REQ_DEL_PREV       Delete character before the cursor.
50       REQ_DEL_WORD       Delete blank-delimited word at the cursor.
51       REQ_DOWN_CHAR      Move down in the field.
52       REQ_DOWN_FIELD     Move down to a field.
53       REQ_END_FIELD      Move to the end of the field.
54       REQ_END_LINE       Move to the end of the line.
55       REQ_FIRST_FIELD    Move to the first field.
56       REQ_FIRST_PAGE     Move to the first page.
57       REQ_INS_CHAR       Insert a blank at the cursor.
58       REQ_INS_LINE       Insert a blank line at the cursor.
59       REQ_INS_MODE       Enter insert mode.
60       REQ_LAST_FIELD     Move to the last field.
61       REQ_LAST_PAGE      Move to the last field.
62       REQ_LEFT_CHAR      Move left in the field.
63       REQ_LEFT_FIELD     Move left to a field.
64       REQ_NEW_LINE       Insert or overlay a new line.
65       REQ_NEXT_CHAR      Move to the next char.
66
67       REQ_NEXT_CHOICE    Display next field choice.
68       REQ_NEXT_FIELD     Move to the next field.
69       REQ_NEXT_LINE      Move to the next line.
70       REQ_NEXT_PAGE      Move to the next page.
71       REQ_NEXT_PAGE      Move to the next page.
72       REQ_NEXT_WORD      Move to the next word.
73       REQ_OVL_MODE       Enter overlay mode.
74       REQ_PREV_CHAR      Move to the previous char.
75       REQ_PREV_CHOICE    Display previous field choice.
76       REQ_PREV_FIELD     Move to the previous field.
77       REQ_PREV_LINE      Move to the previous line.
78       REQ_PREV_PAGE      Move to the previous page.
79       REQ_PREV_WORD      Move to the previous word.
80       REQ_RIGHT_CHAR     Move right in the field.
81       REQ_RIGHT_FIELD    Move right to a field.
82       REQ_SCR_BCHAR      Scroll the field backward a character.
83       REQ_SCR_BHPAGE     Scroll the field backward half a page.
84       REQ_SCR_BLINE      Scroll the field backward a line.
85       REQ_SCR_BPAGE      Scroll the field backward a page.
86       REQ_SCR_FCHAR      Scroll the field forward a character.
87       REQ_SCR_FHPAGE     Scroll the field forward half a page.
88       REQ_SCR_FLINE      Scroll the field forward a line.
89       REQ_SCR_FPAGE      Scroll the field forward a page.
90       REQ_SCR_HBHALF     Horizontal scroll the field backward half a line.
91       REQ_SCR_HBLINE     Horizontal scroll the field backward a line.
92       REQ_SCR_HFHALF     Horizontal scroll the field forward half a line.
93       REQ_SCR_HFLINE     Horizontal scroll the field forward a line.
94       REQ_SFIRST_FIELD   Move to the sorted first field.
95       REQ_SLAST_FIELD    Move to the sorted last field.
96       REQ_SNEXT_FIELD    Move to the sorted next field.
97       REQ_SPREV_FIELD    Move to the sorted previous field.
98       REQ_UP_CHAR        Move up in the field.
99       REQ_UP_FIELD       Move up to a field.
100       REQ_VALIDATION     Validate field.
101
102       If  the  second argument is a printable character, the driver places it
103       in the current position in the current field.  If  it  is  one  of  the
104       forms requests listed above, that request is executed.
105
106   Field validation
107       The  form  library  makes  updates  to  the window associated with form
108       fields rather than directly to the field buffers.
109
110       The form driver provides low-level control over  updates  to  the  form
111       fields.   The  form driver also provides for validating modified fields
112       to ensure that the contents meet whatever  constraints  an  application
113       may attach using set_field_type.
114
115       You  can  validate  a  field  without  making  any  changes to it using
116       REQ_VALIDATION.  The form driver also validates a field in these cases:
117
118       •   a call to set_current_field attempts to move to a different field.
119
120       •   a call to set_current_page attempts to move to a different page  of
121           the form.
122
123       •   a request attempts to move to a different field.
124
125       •   a request attempts to move to a different page of the form.
126
127       In each case, the move fails if the field is invalid.
128
129       If  the  modified  field  is valid, the form driver copies the modified
130       data from the window associated with the field to the field buffer.
131
132   Mouse handling
133       If the second argument is the KEY_MOUSE  special  key,  the  associated
134       mouse  event  is translated into one of the above pre-defined requests.
135       Currently only clicks in the user window (e.g., inside the form display
136       area or the decoration window) are handled.
137
138       If you click above the display region of the form:
139
140          a REQ_PREV_FIELD is generated for a single click,
141
142          a REQ_PREV_PAGE is generated for a double-click and
143
144          a REQ_FIRST_FIELD is generated for a triple-click.
145
146       If you click below the display region of the form:
147
148          a REQ_NEXT_FIELD is generated for a single click,
149
150          a REQ_NEXT_PAGE is generated for a double-click and
151
152          a REQ_LAST_FIELD is generated for a triple-click.
153
154       If you click at an field inside the display area of the form:
155
156          •   the form cursor is positioned to that field.
157
158          •   If  you  double-click  a field, the form cursor is positioned to
159              that field and E_UNKNOWN_COMMAND is returned.  This return value
160              makes sense, because a double click usually means that an field-
161              specific action should be returned.  It is exactly  the  purpose
162              of this return value to signal that an application specific com‐
163              mand should be executed.
164
165          •   If a translation into a request was  done,  form_driver  returns
166              the result of this request.
167
168       If  you clicked outside the user window or the mouse event could not be
169       translated into a form request an E_REQUEST_DENIED is returned.
170
171   Application-defined commands
172       If the second argument is neither printable nor one of the  above  pre-
173       defined form requests, the driver assumes it is an application-specific
174       command and returns  E_UNKNOWN_COMMAND.   Application-defined  commands
175       should  be  defined relative to MAX_COMMAND, the maximum value of these
176       pre-defined requests.
177

RETURN VALUE

179       form_driver returns one of the following error codes:
180
181       E_OK The routine succeeded.
182
183       E_BAD_ARGUMENT
184            Routine detected an incorrect or out-of-range argument.
185
186       E_BAD_STATE
187            Routine was called from an initialization or termination function.
188
189       E_NOT_POSTED
190            The form has not been posted.
191
192       E_INVALID_FIELD
193            Contents of field is invalid.
194
195       E_NOT_CONNECTED
196            No fields are connected to the form.
197
198       E_REQUEST_DENIED
199            The form driver could not process the request.
200
201       E_SYSTEM_ERROR
202            System error occurred (see errno(3)).
203
204       E_UNKNOWN_COMMAND
205            The form driver code saw an unknown request code.
206

SEE ALSO

208       curses(3X),   form(3X),   form_fieldtype(3X),    form_field_buffer(3X),
209       form_field_validation(3X), form_variables(3X), getch(3X).
210

NOTES

212       The  header  file  <form.h>  automatically  includes  the  header files
213       <curses.h>.
214

PORTABILITY

216       These routines emulate the System V forms library.  They were not  sup‐
217       ported on Version 7 or BSD versions.
218

AUTHORS

220       Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric S.
221       Raymond.
222
223
224
225                                                               form_driver(3X)
Impressum