]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/form_driver.3x.html
74c3c0b7d11b30920ef096ad3d3e3959743c38e2
[ncurses.git] / doc / html / man / form_driver.3x.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 1998-2015,2016 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.26 2016/12/04 01:01:17 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
50        the form system
51
52
53 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
54        <STRONG>#include</STRONG> <STRONG>&lt;form.h&gt;</STRONG>
55        <STRONG>int</STRONG> <STRONG>form_driver(FORM</STRONG> <STRONG>*</STRONG><EM>form</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>c</EM><STRONG>);</STRONG>
56        <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>
57
58
59 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
60
61 </PRE><H3><a name="h3-form_driver">form_driver</a></H3><PRE>
62        Once a form has been posted (displayed), you should funnel
63        input  events to it through <STRONG>form_driver</STRONG>.  This routine has
64        three major input cases:
65
66        <STRONG>o</STRONG>   The input is a form  navigation  request.   Navigation
67            request codes are constants defined in <STRONG>&lt;form.h&gt;</STRONG>, which
68            are  distinct  from  the  key-  and  character   codes
69            returned by <STRONG><A HREF="wgetch.3x.html">wgetch(3x)</A></STRONG>.
70
71        <STRONG>o</STRONG>   The input is a printable character.  Printable charac-
72            ters (which must  be  positive,  less  than  256)  are
73            checked according to the program's locale settings.
74
75        <STRONG>o</STRONG>   The input is the KEY_MOUSE special key associated with
76            an mouse event.
77
78
79 </PRE><H3><a name="h3-form_driver_w">form_driver_w</a></H3><PRE>
80        This extension simplifies the use  of  the  forms  library
81        using  wide characters.  The input is either a key code (a
82        request) or a wide character returned by <STRONG><A HREF="get_wch.3x.html">get_wch(3x)</A></STRONG>.  The
83        type  must  be  passed  as  well, to enable the library to
84        determine whether the parameter is a wide character  or  a
85        request.
86
87
88 </PRE><H3><a name="h3-Form-driver-requests">Form-driver requests</a></H3><PRE>
89        The form driver requests are as follows:
90
91        <EM>Name</EM>               <EM>Description</EM>
92        -------------------------------------------------------------------------
93        REQ_BEG_FIELD      Move to the beginning of the field.
94        REQ_BEG_LINE       Move to the beginning of the line.
95        REQ_CLR_EOF        Clear to end of field from cursor.
96        REQ_CLR_EOL        Clear to end of line from cursor.
97        REQ_CLR_FIELD      Clear the entire field.
98        REQ_DEL_CHAR       Delete character at the cursor.
99        REQ_DEL_LINE       Delete line at the cursor.
100        REQ_DEL_PREV       Delete character before the cursor.
101        REQ_DEL_WORD       Delete blank-delimited word at the cursor.
102        REQ_DOWN_CHAR      Move down in the field.
103        REQ_DOWN_FIELD     Move down to a field.
104        REQ_END_FIELD      Move to the end of the field.
105        REQ_END_LINE       Move to the end of the line.
106        REQ_FIRST_FIELD    Move to the first field.
107        REQ_FIRST_PAGE     Move to the first page.
108        REQ_INS_CHAR       Insert a blank at the cursor.
109        REQ_INS_LINE       Insert a blank line at the cursor.
110        REQ_INS_MODE       Enter insert mode.
111        REQ_LAST_FIELD     Move to the last field.
112        REQ_LAST_PAGE      Move to the last field.
113        REQ_LEFT_CHAR      Move left in the field.
114
115        REQ_LEFT_FIELD     Move left to a field.
116        REQ_NEW_LINE       Insert or overlay a new line.
117        REQ_NEXT_CHAR      Move to the next char.
118        REQ_NEXT_CHOICE    Display next field choice.
119        REQ_NEXT_FIELD     Move to the next field.
120        REQ_NEXT_LINE      Move to the next line.
121        REQ_NEXT_PAGE      Move to the next page.
122        REQ_NEXT_PAGE      Move to the next page.
123        REQ_NEXT_WORD      Move to the next word.
124        REQ_OVL_MODE       Enter overlay mode.
125        REQ_PREV_CHAR      Move to the previous char.
126        REQ_PREV_CHOICE    Display previous field choice.
127        REQ_PREV_FIELD     Move to the previous field.
128        REQ_PREV_LINE      Move to the previous line.
129        REQ_PREV_PAGE      Move to the previous page.
130        REQ_PREV_WORD      Move to the previous word.
131        REQ_RIGHT_CHAR     Move right in the field.
132        REQ_RIGHT_FIELD    Move right to a field.
133        REQ_SCR_BCHAR      Scroll the field backward a character.
134        REQ_SCR_BHPAGE     Scroll the field backward half a page.
135        REQ_SCR_BLINE      Scroll the field backward a line.
136        REQ_SCR_BPAGE      Scroll the field backward a page.
137        REQ_SCR_FCHAR      Scroll the field forward a character.
138        REQ_SCR_FHPAGE     Scroll the field forward half a page.
139        REQ_SCR_FLINE      Scroll the field forward a line.
140        REQ_SCR_FPAGE      Scroll the field forward a page.
141        REQ_SCR_HBHALF     Horizontal scroll the field backward half a line.
142        REQ_SCR_HBLINE     Horizontal scroll the field backward a line.
143        REQ_SCR_HFHALF     Horizontal scroll the field forward half a line.
144        REQ_SCR_HFLINE     Horizontal scroll the field forward a line.
145        REQ_SFIRST_FIELD   Move to the sorted first field.
146        REQ_SLAST_FIELD    Move to the sorted last field.
147        REQ_SNEXT_FIELD    Move to the sorted next field.
148        REQ_SPREV_FIELD    Move to the sorted previous field.
149        REQ_UP_CHAR        Move up in the field.
150        REQ_UP_FIELD       Move up to a field.
151        REQ_VALIDATION     Validate field.
152
153        If  the  second  argument  is  a  printable character, the
154        driver places it in the current position  in  the  current
155        field.   If  it is one of the forms requests listed above,
156        that request is executed.
157
158
159 </PRE><H3><a name="h3-Field-validation">Field validation</a></H3><PRE>
160        The form library makes updates to  the  window  associated
161        with  form  fields  rather than directly to the field buf-
162        fers.
163
164        The form driver provides low-level control over updates to
165        the  form fields.  The form driver also provides for vali-
166        dating modified fields to ensure that  the  contents  meet
167        whatever  constraints  an  application  may  attach  using
168        <STRONG>set_field_type</STRONG>.
169
170        You can validate a field without making any changes to  it
171        using  <STRONG>REQ_VALIDATION</STRONG>.   The  form driver also validates a
172        field in these cases:
173
174        <STRONG>o</STRONG>   a call to <STRONG>set_current_field</STRONG> attempts to move to a dif-
175            ferent field.
176
177        <STRONG>o</STRONG>   a  call to <STRONG>set_current_page</STRONG> attempts to move to a dif-
178            ferent page of the form.
179
180        <STRONG>o</STRONG>   a request attempts to move to a different field.
181
182        <STRONG>o</STRONG>   a request attempts to move to a different page of  the
183            form.
184
185        In each case, the move fails if the field is invalid.
186
187        If the modified field is valid, the form driver copies the
188        modified data from the window associated with the field to
189        the field buffer.
190
191
192 </PRE><H3><a name="h3-Mouse-handling">Mouse handling</a></H3><PRE>
193        If  the  second argument is the KEY_MOUSE special key, the
194        associated mouse event is translated into one of the above
195        pre-defined  requests.   Currently only clicks in the user
196        window (e.g., inside the form display area or the  decora-
197        tion window) are handled.
198
199        If you click above the display region of the form:
200
201           a REQ_PREV_FIELD is generated for a single click,
202
203           a REQ_PREV_PAGE is generated for a double-click and
204
205           a REQ_FIRST_FIELD is generated for a triple-click.
206
207        If you click below the display region of the form:
208
209           a REQ_NEXT_FIELD is generated for a single click,
210
211           a REQ_NEXT_PAGE is generated for a double-click and
212
213           a REQ_LAST_FIELD is generated for a triple-click.
214
215        If  you  click  at an field inside the display area of the
216        form:
217
218           <STRONG>o</STRONG>   the form cursor is positioned to that field.
219
220           <STRONG>o</STRONG>   If you double-click a field,  the  form  cursor  is
221               positioned  to  that field and <STRONG>E_UNKNOWN_COMMAND</STRONG> is
222               returned.  This return value makes sense, because a
223               double  click  usually means that an field-specific
224               action should be returned.  It is exactly the  pur-
225               pose  of this return value to signal that an appli-
226               cation specific command should be executed.
227
228           <STRONG>o</STRONG>   If  a  translation  into  a   request   was   done,
229               <STRONG>form_driver</STRONG> returns the result of this request.
230
231        If  you clicked outside the user window or the mouse event
232        could  not  be  translated  into   a   form   request   an
233        <STRONG>E_REQUEST_DENIED</STRONG> is returned.
234
235
236 </PRE><H3><a name="h3-Application-defined-commands">Application-defined commands</a></H3><PRE>
237        If the second argument is neither printable nor one of the
238        above pre-defined form requests, the driver assumes it  is
239        an application-specific command and returns <STRONG>E_UNKNOWN_COM-</STRONG>
240        <STRONG>MAND</STRONG>.  Application-defined commands should be defined rel-
241        ative  to  <STRONG>MAX_COMMAND</STRONG>,  the  maximum  value of these pre-
242        defined requests.
243
244
245 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
246        <STRONG>form_driver</STRONG> returns one of the following error codes:
247
248        <STRONG>E_OK</STRONG> The routine succeeded.
249
250        <STRONG>E_BAD_ARGUMENT</STRONG>
251             Routine detected an incorrect or  out-of-range  argu-
252             ment.
253
254        <STRONG>E_BAD_STATE</STRONG>
255             Routine was called from an initialization or termina-
256             tion function.
257
258        <STRONG>E_NOT_POSTED</STRONG>
259             The form has not been posted.
260
261        <STRONG>E_INVALID_FIELD</STRONG>
262             Contents of field is invalid.
263
264        <STRONG>E_REQUEST_DENIED</STRONG>
265             The form driver could not process the request.
266
267        <STRONG>E_SYSTEM_ERROR</STRONG>
268             System error occurred (see <STRONG>errno</STRONG>).
269
270        <STRONG>E_UNKNOWN_COMMAND</STRONG>
271             The form driver code saw an unknown request code.
272
273
274 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
275        <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>,
276        <STRONG><A HREF="form_field_validation.3x.html">form_field_validation(3x)</A></STRONG>,  <STRONG><A HREF="form_fieldtype.3x.html">form_fieldtype(3x)</A></STRONG>, <STRONG>form_vari-</STRONG>
277        <STRONG><A HREF="form_variables.3x.html">ables(3x)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">curs_getch(3x)</A></STRONG>.
278
279
280 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
281        The header file <STRONG>&lt;form.h&gt;</STRONG> automatically includes the header
282        files <STRONG>&lt;curses.h&gt;</STRONG>.
283
284
285 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
286        These  routines  emulate the System V forms library.  They
287        were not supported on Version 7 or BSD versions.
288
289
290 </PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
291        Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
292        curses by Eric S. Raymond.
293
294
295
296                                                         <STRONG><A HREF="form_driver.3x.html">form_driver(3x)</A></STRONG>
297 </PRE>
298 <div class="nav">
299 <ul>
300 <li><a href="#h2-NAME">NAME</a></li>
301 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
302 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
303 <ul>
304 <li><a href="#h3-form_driver">form_driver</a></li>
305 <li><a href="#h3-form_driver_w">form_driver_w</a></li>
306 <li><a href="#h3-Form-driver-requests">Form-driver requests</a></li>
307 <li><a href="#h3-Field-validation">Field validation</a></li>
308 <li><a href="#h3-Mouse-handling">Mouse handling</a></li>
309 <li><a href="#h3-Application-defined-commands">Application-defined commands</a></li>
310 </ul>
311 </li>
312 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
313 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
314 <li><a href="#h2-NOTES">NOTES</a></li>
315 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
316 <li><a href="#h2-AUTHORS">AUTHORS</a></li>
317 </ul>
318 </div>
319 </BODY>
320 </HTML>