1 .\" $NetBSD: form_driver.3,v 1.9 2004/11/24 12:12:19 wiz Exp $
4 .\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au
6 .\" This code is donated to The NetBSD Foundation by the author.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. The name of the Author may not be used to endorse or promote
17 .\" products derived from this software without specific prior written
20 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 .Fn form_driver "FORM *form" "int request"
47 is the heart of the forms library, it takes commands in the
49 parameter that is either a request to the driver to perform some
50 action or is a character to be inserted into the current field.
51 The form driver will attempt to insert any printable character passed to
52 it into the current field.
53 This may or may not succeed depending on the state of the current field.
54 If the character passed is not
55 printable then the driver attempts to process it as a driver request.
56 If the character passed is not a valid request then the driver will
57 return an unknown command error.
59 The forms driver recognizes the following requests:
61 .Bl -tag -width REQ_SFIRST_FIELD -compact
63 Change to the next page in the form.
65 Change to the previous page in the form.
67 Select the first page in the form.
69 Go to the last page in the form.
71 Move to the next field in the form field array.
73 Move to the previous field in the form field array.
75 Go to the first field in the form field array.
77 Go to the last field in the form field array.
79 Move to the next sorted field on the form.
81 Move to the previous sorted field on the form.
83 Go to the first field in the sorted list.
85 Move to the last field in the sorted list.
87 Go one field to the left on the form page.
89 Go one field to the right on the form page.
91 Go up one field on the form page.
93 Go down one field on the form page.
95 Move one char to the right within the field
97 Move one char to the left within the current field.
99 Go down one line in the current field.
101 Go up one line in the current field.
103 Go forward one word in the current field
105 Go backward one word in the current field.
107 Move the cursor to the beginning of the current field.
109 Move the cursor to the end of the current field.
111 Move the cursor to the beginning of the line in the current field.
113 Move the cursor to the end of the line.
115 Move the cursor left one character
117 Move the cursor right one character
119 Move the cursor up one line.
121 Move the cursor down one line.
123 Insert a new line at the current cursor position.
125 Insert a blank character at the current cursor position
127 Open a blank line at the current cursor position.
129 Delete the character at the current cursor position.
131 Delete the character to the left of the current cursor position.
133 Delete the current line.
135 Delete the word at the current cursor position.
137 Clear the field from the current cursor position to the end of the
140 Clear the field from the current cursor position to the end of the field.
144 Enter overlay mode, characters added to the field will replace the
147 Enter insert mode, characters will be inserted at the current cursor
149 Any characters to the right of the cursor will be moved
150 right to accommodate the new characters.
152 Scroll the field forward one line.
154 Scroll the field backward one line.
156 Scroll the field forward one field page.
158 Scroll the field backward one field page.
160 Scroll the field forward half one field page.
162 Scroll the field backward half one field page.
164 Scroll the field horizontally forward one character
166 Scroll the field horizontally backward one character
168 Scroll the field horizontally forward one field line.
170 Scroll the field horizontally backward one field line.
172 Scroll the field horizontally forward half a field line.
174 Scroll the field horizontally backward half a field line.
176 Request the contents of the current field be validated using any field
177 validation function that has been set for the field.
178 Normally, the field is validated before the current field changes.
179 This request allows the current field to be validated.
181 Select the previous choice in an enumerated type field.
183 Select the next choice in an enumerated type field.
186 Functions returning pointers will return
188 if an error is detected.
189 The functions that return an int will return one of the following error
192 .Bl -tag -width E_UNKNOWN_COMMAND -compact
194 The function was successful.
195 .It Er E_REQUEST_DENIED
196 The forms driver request could not be fulfilled
197 .It Er E_UNKNOWN_COMMAND
198 The passed character is not a printable character and is not a valid
199 forms driver request.
200 .It Er E_BAD_ARGUMENT
201 A bad argument was passed to the forms driver.
202 .It Er E_INVALID_FIELD
203 The form passed to the driver has no valid attached fields.
205 The given form is not currently posted to the screen.
207 The forms driver was called from within an init or term function.
208 .It Er E_INVALID_FIELD
209 The character passed to the forms driver fails the character
210 validation for the current field.
216 Field sorting is done by location of the field on the form page, the
217 fields are sorted by position starting with the top-most, left-most
218 field and progressing left to right.
219 For the purposes of sorting, the
220 fields top left corner is used as the sort criteria.
223 automatically includes both