]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/form_driver.3x.html
ncurses 6.0 - patch 20171118
[ncurses.git] / doc / html / man / form_driver.3x.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
4   *                                                                          *
5   * Permission is hereby granted, free of charge, to any person obtaining a  *
6   * copy of this software and associated documentation files (the            *
7   * "Software"), to deal in the Software without restriction, including      *
8   * without limitation the rights to use, copy, modify, merge, publish,      *
9   * distribute, distribute with modifications, sublicense, and/or sell       *
10   * copies of the Software, and to permit persons to whom the Software is    *
11   * furnished to do so, subject to the following conditions:                 *
12   *                                                                          *
13   * The above copyright notice and this permission notice shall be included  *
14   * in all copies or substantial portions of the Software.                   *
15   *                                                                          *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23   *                                                                          *
24   * Except as contained in this notice, the name(s) of the above copyright   *
25   * holders shall not be used in advertising or otherwise to promote the     *
26   * sale, use or other dealings in this Software without prior written       *
27   * authorization.                                                           *
28   ****************************************************************************
29   * @Id: form_driver.3x,v 1.28 2017/11/18 23:47:37 tom Exp @
30 -->
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
32 <HTML>
33 <HEAD>
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
36 <TITLE>form_driver 3x</TITLE>
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
39 </HEAD>
40 <BODY>
41 <H1 class="no-header">form_driver 3x</H1>
42 <PRE>
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>
44
45
46
47
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49        <STRONG>form_driver</STRONG>, <STRONG>form_driver_w</STRONG> - command-processing loop of the form system
50
51
52 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
53        <STRONG>#include</STRONG> <STRONG>&lt;form.h&gt;</STRONG>
54        <STRONG>int</STRONG> <STRONG>form_driver(FORM</STRONG> <STRONG>*</STRONG><EM>form</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>c</EM><STRONG>);</STRONG>
55        <STRONG>int</STRONG> <STRONG>form_driver_w(FORM</STRONG> <STRONG>*</STRONG><EM>form</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>c</EM><STRONG>,</STRONG> <STRONG>wchar_t</STRONG> <EM>wch</EM><STRONG>);</STRONG>
56
57
58 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
59
60 </PRE><H3><a name="h3-form_driver">form_driver</a></H3><PRE>
61        Once a form has been posted (displayed), you should funnel input events
62        to it through <STRONG>form_driver</STRONG>.  This routine has three major input cases:
63
64        <STRONG>o</STRONG>   The input is a form navigation request.  Navigation  request  codes
65            are constants defined in <STRONG>&lt;form.h&gt;</STRONG>, which are distinct from the key-
66            and character codes returned by <STRONG><A HREF="curs_getch.3x.html">wgetch(3x)</A></STRONG>.
67
68        <STRONG>o</STRONG>   The input is a printable character.   Printable  characters  (which
69            must  be positive, less than 256) are checked according to the pro-
70            gram's locale settings.
71
72        <STRONG>o</STRONG>   The input is the KEY_MOUSE special key  associated  with  an  mouse
73            event.
74
75
76 </PRE><H3><a name="h3-form_driver_w">form_driver_w</a></H3><PRE>
77        This extension simplifies the use of the forms library using wide char-
78        acters.  The input is either a key code (a request) or a wide character
79        returned  by  <STRONG><A HREF="curs_get_wch.3x.html">get_wch(3x)</A></STRONG>.   The type must be passed as well, to enable
80        the library to determine whether the parameter is a wide character or a
81        request.
82
83
84 </PRE><H3><a name="h3-Form-driver-requests">Form-driver requests</a></H3><PRE>
85        The form driver requests are as follows:
86
87        <EM>Name</EM>               <EM>Description</EM>
88        ---------------------------------------------------------------------
89        REQ_BEG_FIELD      Move to the beginning of the field.
90        REQ_BEG_LINE       Move to the beginning of the line.
91        REQ_CLR_EOF        Clear to end of field from cursor.
92        REQ_CLR_EOL        Clear to end of line from cursor.
93        REQ_CLR_FIELD      Clear the entire field.
94        REQ_DEL_CHAR       Delete character at the cursor.
95        REQ_DEL_LINE       Delete line at the cursor.
96        REQ_DEL_PREV       Delete character before the cursor.
97        REQ_DEL_WORD       Delete blank-delimited word at the cursor.
98        REQ_DOWN_CHAR      Move down in the field.
99        REQ_DOWN_FIELD     Move down to a field.
100        REQ_END_FIELD      Move to the end of the field.
101        REQ_END_LINE       Move to the end of the line.
102        REQ_FIRST_FIELD    Move to the first field.
103        REQ_FIRST_PAGE     Move to the first page.
104        REQ_INS_CHAR       Insert a blank at the cursor.
105        REQ_INS_LINE       Insert a blank line at the cursor.
106        REQ_INS_MODE       Enter insert mode.
107        REQ_LAST_FIELD     Move to the last field.
108        REQ_LAST_PAGE      Move to the last field.
109        REQ_LEFT_CHAR      Move left in the field.
110        REQ_LEFT_FIELD     Move left to a field.
111        REQ_NEW_LINE       Insert or overlay a new line.
112        REQ_NEXT_CHAR      Move to the next char.
113        REQ_NEXT_CHOICE    Display next field choice.
114
115        REQ_NEXT_FIELD     Move to the next field.
116        REQ_NEXT_LINE      Move to the next line.
117        REQ_NEXT_PAGE      Move to the next page.
118        REQ_NEXT_PAGE      Move to the next page.
119        REQ_NEXT_WORD      Move to the next word.
120        REQ_OVL_MODE       Enter overlay mode.
121        REQ_PREV_CHAR      Move to the previous char.
122        REQ_PREV_CHOICE    Display previous field choice.
123        REQ_PREV_FIELD     Move to the previous field.
124        REQ_PREV_LINE      Move to the previous line.
125        REQ_PREV_PAGE      Move to the previous page.
126        REQ_PREV_WORD      Move to the previous word.
127        REQ_RIGHT_CHAR     Move right in the field.
128        REQ_RIGHT_FIELD    Move right to a field.
129        REQ_SCR_BCHAR      Scroll the field backward a character.
130        REQ_SCR_BHPAGE     Scroll the field backward half a page.
131        REQ_SCR_BLINE      Scroll the field backward a line.
132        REQ_SCR_BPAGE      Scroll the field backward a page.
133        REQ_SCR_FCHAR      Scroll the field forward a character.
134        REQ_SCR_FHPAGE     Scroll the field forward half a page.
135        REQ_SCR_FLINE      Scroll the field forward a line.
136        REQ_SCR_FPAGE      Scroll the field forward a page.
137        REQ_SCR_HBHALF     Horizontal scroll the field backward half a line.
138        REQ_SCR_HBLINE     Horizontal scroll the field backward a line.
139        REQ_SCR_HFHALF     Horizontal scroll the field forward half a line.
140        REQ_SCR_HFLINE     Horizontal scroll the field forward a line.
141        REQ_SFIRST_FIELD   Move to the sorted first field.
142        REQ_SLAST_FIELD    Move to the sorted last field.
143        REQ_SNEXT_FIELD    Move to the sorted next field.
144        REQ_SPREV_FIELD    Move to the sorted previous field.
145        REQ_UP_CHAR        Move up in the field.
146        REQ_UP_FIELD       Move up to a field.
147        REQ_VALIDATION     Validate field.
148
149        If  the  second argument is a printable character, the driver places it
150        in the current position in the current field.  If  it  is  one  of  the
151        forms requests listed above, that request is executed.
152
153
154 </PRE><H3><a name="h3-Field-validation">Field validation</a></H3><PRE>
155        The  form  library  makes  updates  to  the window associated with form
156        fields rather than directly to the field buffers.
157
158        The form driver provides low-level control over  updates  to  the  form
159        fields.   The  form driver also provides for validating modified fields
160        to ensure that the contents meet whatever  constraints  an  application
161        may attach using <STRONG>set_field_type</STRONG>.
162
163        You  can  validate  a  field  without  making  any  changes to it using
164        <STRONG>REQ_VALIDATION</STRONG>.  The form driver also validates a field in these cases:
165
166        <STRONG>o</STRONG>   a call to <STRONG>set_current_field</STRONG> attempts to move to a different field.
167
168        <STRONG>o</STRONG>   a call to <STRONG>set_current_page</STRONG> attempts to move to a different page  of
169            the form.
170
171        <STRONG>o</STRONG>   a request attempts to move to a different field.
172
173        <STRONG>o</STRONG>   a request attempts to move to a different page of the form.
174
175        In each case, the move fails if the field is invalid.
176
177        If  the  modified  field  is valid, the form driver copies the modified
178        data from the window associated with the field to the field buffer.
179
180
181 </PRE><H3><a name="h3-Mouse-handling">Mouse handling</a></H3><PRE>
182        If the second argument is the KEY_MOUSE  special  key,  the  associated
183        mouse  event  is translated into one of the above pre-defined requests.
184        Currently only clicks in the user window (e.g., inside the form display
185        area or the decoration window) are handled.
186
187        If you click above the display region of the form:
188
189           a REQ_PREV_FIELD is generated for a single click,
190
191           a REQ_PREV_PAGE is generated for a double-click and
192
193           a REQ_FIRST_FIELD is generated for a triple-click.
194
195        If you click below the display region of the form:
196
197           a REQ_NEXT_FIELD is generated for a single click,
198
199           a REQ_NEXT_PAGE is generated for a double-click and
200
201           a REQ_LAST_FIELD is generated for a triple-click.
202
203        If you click at an field inside the display area of the form:
204
205           <STRONG>o</STRONG>   the form cursor is positioned to that field.
206
207           <STRONG>o</STRONG>   If  you  double-click  a field, the form cursor is positioned to
208               that field and <STRONG>E_UNKNOWN_COMMAND</STRONG> is returned.  This return value
209               makes sense, because a double click usually means that an field-
210               specific action should be returned.  It is exactly  the  purpose
211               of this return value to signal that an application specific com-
212               mand should be executed.
213
214           <STRONG>o</STRONG>   If a translation into a request was  done,  <STRONG>form_driver</STRONG>  returns
215               the result of this request.
216
217        If  you clicked outside the user window or the mouse event could not be
218        translated into a form request an <STRONG>E_REQUEST_DENIED</STRONG> is returned.
219
220
221 </PRE><H3><a name="h3-Application-defined-commands">Application-defined commands</a></H3><PRE>
222        If the second argument is neither printable nor one of the  above  pre-
223        defined form requests, the driver assumes it is an application-specific
224        command and returns  <STRONG>E_UNKNOWN_COMMAND</STRONG>.   Application-defined  commands
225        should  be  defined relative to <STRONG>MAX_COMMAND</STRONG>, the maximum value of these
226        pre-defined requests.
227
228
229 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
230        <STRONG>form_driver</STRONG> returns one of the following error codes:
231
232        <STRONG>E_OK</STRONG> The routine succeeded.
233
234        <STRONG>E_BAD_ARGUMENT</STRONG>
235             Routine detected an incorrect or out-of-range argument.
236
237        <STRONG>E_BAD_STATE</STRONG>
238             Routine was called from an initialization or termination function.
239
240        <STRONG>E_NOT_POSTED</STRONG>
241             The form has not been posted.
242
243        <STRONG>E_INVALID_FIELD</STRONG>
244             Contents of field is invalid.
245
246        <STRONG>E_REQUEST_DENIED</STRONG>
247             The form driver could not process the request.
248
249        <STRONG>E_SYSTEM_ERROR</STRONG>
250             System error occurred (see <STRONG>errno</STRONG>).
251
252        <STRONG>E_UNKNOWN_COMMAND</STRONG>
253             The form driver code saw an unknown request code.
254
255
256 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
257        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="form.3x.html">form(3x)</A></STRONG>, <STRONG><A HREF="form_field_buffer.3x.html">form_field_buffer(3x)</A></STRONG>, <STRONG><A HREF="form_field_validation.3x.html">form_field_validation(3x)</A></STRONG>,
258        <STRONG><A HREF="form_fieldtype.3x.html">form_fieldtype(3x)</A></STRONG>, <STRONG><A HREF="form_variables.3x.html">form_variables(3x)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">getch(3x)</A></STRONG>.
259
260
261 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
262        The  header  file  <STRONG>&lt;form.h&gt;</STRONG>  automatically  includes  the  header files
263        <STRONG>&lt;curses.h&gt;</STRONG>.
264
265
266 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
267        These routines emulate the System V forms library.  They were not  sup-
268        ported on Version 7 or BSD versions.
269
270
271 </PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
272        Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric S.
273        Raymond.
274
275
276
277                                                                <STRONG><A HREF="form_driver.3x.html">form_driver(3x)</A></STRONG>
278 </PRE>
279 <div class="nav">
280 <ul>
281 <li><a href="#h2-NAME">NAME</a></li>
282 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
283 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
284 <ul>
285 <li><a href="#h3-form_driver">form_driver</a></li>
286 <li><a href="#h3-form_driver_w">form_driver_w</a></li>
287 <li><a href="#h3-Form-driver-requests">Form-driver requests</a></li>
288 <li><a href="#h3-Field-validation">Field validation</a></li>
289 <li><a href="#h3-Mouse-handling">Mouse handling</a></li>
290 <li><a href="#h3-Application-defined-commands">Application-defined commands</a></li>
291 </ul>
292 </li>
293 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
294 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
295 <li><a href="#h2-NOTES">NOTES</a></li>
296 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
297 <li><a href="#h2-AUTHORS">AUTHORS</a></li>
298 </ul>
299 </div>
300 </BODY>
301 </HTML>