Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame^] | 1 | <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> |
| 2 | <!-- |
| 3 | **************************************************************************** |
| 4 | * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * |
| 5 | * * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a * |
| 7 | * copy of this software and associated documentation files (the * |
| 8 | * "Software"), to deal in the Software without restriction, including * |
| 9 | * without limitation the rights to use, copy, modify, merge, publish, * |
| 10 | * distribute, distribute with modifications, sublicense, and/or sell * |
| 11 | * copies of the Software, and to permit persons to whom the Software is * |
| 12 | * furnished to do so, subject to the following conditions: * |
| 13 | * * |
| 14 | * The above copyright notice and this permission notice shall be included * |
| 15 | * in all copies or substantial portions of the Software. * |
| 16 | * * |
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 20 | * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 21 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 22 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 23 | * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 24 | * * |
| 25 | * Except as contained in this notice, the name(s) of the above copyright * |
| 26 | * holders shall not be used in advertising or otherwise to promote the * |
| 27 | * sale, use or other dealings in this Software without prior written * |
| 28 | * authorization. * |
| 29 | **************************************************************************** |
| 30 | * @Id: form_driver.3x,v 1.16 2008/06/21 21:55:39 tom Exp @ |
| 31 | --> |
| 32 | <HTML> |
| 33 | <HEAD> |
| 34 | <TITLE>form_driver 3x</TITLE> |
| 35 | <link rev=made href="mailto:bug-ncurses@gnu.org"> |
| 36 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
| 37 | </HEAD> |
| 38 | <BODY> |
| 39 | <H1>form_driver 3x</H1> |
| 40 | <HR> |
| 41 | <PRE> |
| 42 | <!-- Manpage converted by man2html 3.0.1 --> |
| 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> |
| 49 | <H2>NAME</H2><PRE> |
| 50 | <STRONG>form_driver</STRONG> - command-processing loop of the form system |
| 51 | |
| 52 | |
| 53 | </PRE> |
| 54 | <H2>SYNOPSIS</H2><PRE> |
| 55 | <STRONG>#include</STRONG> <STRONG><form.h></STRONG> |
| 56 | int form_driver(FORM *form, int c); |
| 57 | |
| 58 | |
| 59 | </PRE> |
| 60 | <H2>DESCRIPTION</H2><PRE> |
| 61 | Once a form has been posted (displayed), you should funnel |
| 62 | input events to it through <STRONG>form_driver</STRONG>. This routine has |
| 63 | three major input cases: |
| 64 | |
| 65 | - The input is a form navigation request. Navigation |
| 66 | request codes are constants defined in <STRONG><form.h></STRONG>, which |
| 67 | are distinct from the key- and character codes returned |
| 68 | by <STRONG>wgetch</STRONG>. |
| 69 | |
| 70 | - The input is a printable character. Printable charac- |
| 71 | ters (which must be positive, less than 256) are |
| 72 | checked according to the program's locale settings. |
| 73 | |
| 74 | - The input is the KEY_MOUSE special key associated with |
| 75 | an mouse event. |
| 76 | |
| 77 | The form driver requests are as follows: |
| 78 | |
| 79 | REQ_NEXT_PAGE |
| 80 | Move to the next page. |
| 81 | |
| 82 | REQ_PREV_PAGE |
| 83 | Move to the previous page. |
| 84 | |
| 85 | REQ_FIRST_PAGE |
| 86 | Move to the first page. |
| 87 | |
| 88 | REQ_LAST_PAGE |
| 89 | Move to the last field. |
| 90 | |
| 91 | |
| 92 | REQ_NEXT_FIELD |
| 93 | Move to the next field. |
| 94 | |
| 95 | REQ_PREV_FIELD |
| 96 | Move to the previous field. |
| 97 | |
| 98 | REQ_FIRST_FIELD |
| 99 | Move to the first field. |
| 100 | |
| 101 | REQ_LAST_FIELD |
| 102 | Move to the last field. |
| 103 | |
| 104 | REQ_SNEXT_FIELD |
| 105 | Move to the sorted next field. |
| 106 | |
| 107 | REQ_SPREV_FIELD |
| 108 | Move to the sorted previous field. |
| 109 | |
| 110 | REQ_SFIRST_FIELD |
| 111 | Move to the sorted first field. |
| 112 | |
| 113 | REQ_SLAST_FIELD |
| 114 | Move to the sorted last field. |
| 115 | |
| 116 | REQ_LEFT_FIELD |
| 117 | Move left to a field. |
| 118 | |
| 119 | REQ_RIGHT_FIELD |
| 120 | Move right to a field. |
| 121 | |
| 122 | REQ_UP_FIELD |
| 123 | Move up to a field. |
| 124 | |
| 125 | REQ_DOWN_FIELD |
| 126 | Move down to a field. |
| 127 | |
| 128 | |
| 129 | REQ_NEXT_CHAR |
| 130 | Move to the next char. |
| 131 | |
| 132 | REQ_PREV_CHAR |
| 133 | Move to the previous char. |
| 134 | |
| 135 | REQ_NEXT_LINE |
| 136 | Move to the next line. |
| 137 | |
| 138 | REQ_PREV_LINE |
| 139 | Move to the previous line. |
| 140 | |
| 141 | REQ_NEXT_WORD |
| 142 | Move to the next word. |
| 143 | |
| 144 | REQ_PREV_WORD |
| 145 | Move to the previous word. |
| 146 | |
| 147 | REQ_BEG_FIELD |
| 148 | Move to the beginning of the field. |
| 149 | |
| 150 | REQ_END_FIELD |
| 151 | Move to the end of the field. |
| 152 | |
| 153 | REQ_BEG_LINE |
| 154 | Move to the beginning of the line. |
| 155 | |
| 156 | REQ_END_LINE |
| 157 | Move to the end of the line. |
| 158 | |
| 159 | REQ_LEFT_CHAR |
| 160 | Move left in the field. |
| 161 | |
| 162 | REQ_RIGHT_CHAR |
| 163 | Move right in the field. |
| 164 | |
| 165 | REQ_UP_CHAR |
| 166 | Move up in the field. |
| 167 | |
| 168 | REQ_DOWN_CHAR |
| 169 | Move down in the field. |
| 170 | |
| 171 | |
| 172 | REQ_NEW_LINE |
| 173 | Insert or overlay a new line. |
| 174 | |
| 175 | REQ_INS_CHAR |
| 176 | Insert a blank at the cursor. |
| 177 | |
| 178 | REQ_INS_LINE |
| 179 | Insert a blank line at the cursor. |
| 180 | |
| 181 | REQ_DEL_CHAR |
| 182 | Delete character at the cursor. |
| 183 | |
| 184 | REQ_DEL_PREV |
| 185 | Delete character before the cursor. |
| 186 | |
| 187 | REQ_DEL_LINE |
| 188 | Delete line at the cursor. |
| 189 | |
| 190 | REQ_DEL_WORD |
| 191 | Delete blank-delimited word at the cursor. |
| 192 | |
| 193 | REQ_CLR_EOL |
| 194 | Clear to end of line from cursor. |
| 195 | |
| 196 | REQ_CLR_EOF |
| 197 | Clear to end of field from cursor. |
| 198 | |
| 199 | REQ_CLR_FIELD |
| 200 | Clear the entire field. |
| 201 | |
| 202 | REQ_OVL_MODE |
| 203 | Enter overlay mode. |
| 204 | |
| 205 | REQ_INS_MODE |
| 206 | Enter insert mode. |
| 207 | |
| 208 | |
| 209 | REQ_SCR_FLINE |
| 210 | Scroll the field forward a line. |
| 211 | |
| 212 | REQ_SCR_BLINE |
| 213 | Scroll the field backward a line. |
| 214 | |
| 215 | REQ_SCR_FPAGE |
| 216 | Scroll the field forward a page. |
| 217 | |
| 218 | REQ_SCR_BPAGE |
| 219 | Scroll the field backward a page. |
| 220 | |
| 221 | REQ_SCR_FHPAGE |
| 222 | Scroll the field forward half a page. |
| 223 | |
| 224 | REQ_SCR_BHPAGE |
| 225 | Scroll the field backward half a page. |
| 226 | |
| 227 | |
| 228 | REQ_SCR_FCHAR |
| 229 | Scroll the field forward a character. |
| 230 | |
| 231 | REQ_SCR_BCHAR |
| 232 | Scroll the field backward a character. |
| 233 | |
| 234 | REQ_SCR_HFLINE |
| 235 | Horizontal scroll the field forward a line. |
| 236 | |
| 237 | REQ_SCR_HBLINE |
| 238 | Horizontal scroll the field backward a line. |
| 239 | |
| 240 | REQ_SCR_HFHALF |
| 241 | Horizontal scroll the field forward half a line. |
| 242 | |
| 243 | REQ_SCR_HBHALF |
| 244 | Horizontal scroll the field backward half a line. |
| 245 | |
| 246 | |
| 247 | REQ_VALIDATION |
| 248 | Validate field. |
| 249 | |
| 250 | REQ_NEXT_CHOICE |
| 251 | Display next field choice. |
| 252 | |
| 253 | REQ_PREV_CHOICE |
| 254 | Display previous field choice. |
| 255 | |
| 256 | If the second argument is a printable character, the |
| 257 | driver places it in the current position in the current |
| 258 | field. If it is one of the forms requests listed above, |
| 259 | that request is executed. |
| 260 | |
| 261 | <STRONG>MOUSE</STRONG> <STRONG>HANDLING</STRONG> |
| 262 | If the second argument is the KEY_MOUSE special key, the |
| 263 | associated mouse event is translated into one of the above |
| 264 | pre-defined requests. Currently only clicks in the user |
| 265 | window (e.g. inside the form display area or the decora- |
| 266 | tion window) are handled. |
| 267 | |
| 268 | If you click above the display region of the form: |
| 269 | |
| 270 | a REQ_PREV_FIELD is generated for a single click, |
| 271 | |
| 272 | a REQ_PREV_PAGE is generated for a double-click and |
| 273 | |
| 274 | a REQ_FIRST_FIELD is generated for a triple-click. |
| 275 | |
| 276 | If you click below the display region of the form: |
| 277 | |
| 278 | a REQ_NEXT_FIELD is generated for a single click, |
| 279 | |
| 280 | a REQ_NEXT_PAGE is generated for a double-click and |
| 281 | |
| 282 | a REQ_LAST_FIELD is generated for a triple-click. |
| 283 | |
| 284 | If you click at an field inside the display area of the |
| 285 | form: |
| 286 | |
| 287 | - the form cursor is positioned to that field. |
| 288 | |
| 289 | - If you double-click a field, the form cursor is |
| 290 | positioned to that field and <STRONG>E_UNKNOWN_COMMAND</STRONG> |
| 291 | is returned. This return value makes sense, |
| 292 | because a double click usually means that an |
| 293 | field-specific action should be returned. It is |
| 294 | exactly the purpose of this return value to sig- |
| 295 | nal that an application specific command should |
| 296 | be executed. |
| 297 | |
| 298 | - If a translation into a request was done, |
| 299 | <STRONG>form_driver</STRONG> returns the result of this request. |
| 300 | |
| 301 | If you clicked outside the user window or the mouse event |
| 302 | could not be translated into a form request an |
| 303 | <STRONG>E_REQUEST_DENIED</STRONG> is returned. |
| 304 | |
| 305 | <STRONG>APPLICATION-DEFINED</STRONG> <STRONG>COMMANDS</STRONG> |
| 306 | If the second argument is neither printable nor one of the |
| 307 | above pre-defined form requests, the driver assumes it is |
| 308 | an application-specific command and returns <STRONG>E_UNKNOWN_COM-</STRONG> |
| 309 | <STRONG>MAND</STRONG>. Application-defined commands should be defined rel- |
| 310 | ative to <STRONG>MAX_COMMAND</STRONG>, the maximum value of these pre- |
| 311 | defined requests. |
| 312 | |
| 313 | |
| 314 | </PRE> |
| 315 | <H2>RETURN VALUE</H2><PRE> |
| 316 | <STRONG>form_driver</STRONG> returns one of the following error codes: |
| 317 | |
| 318 | <STRONG>E_OK</STRONG> The routine succeeded. |
| 319 | |
| 320 | <STRONG>E_BAD_ARGUMENT</STRONG> |
| 321 | Routine detected an incorrect or out-of-range argu- |
| 322 | ment. |
| 323 | |
| 324 | <STRONG>E_BAD_STATE</STRONG> |
| 325 | Routine was called from an initialization or termina- |
| 326 | tion function. |
| 327 | |
| 328 | <STRONG>E_NOT_POSTED</STRONG> |
| 329 | The form has not been posted. |
| 330 | |
| 331 | <STRONG>E_INVALID_FIELD</STRONG> |
| 332 | Contents of field is invalid. |
| 333 | |
| 334 | <STRONG>E_REQUEST_DENIED</STRONG> |
| 335 | The form driver could not process the request. |
| 336 | |
| 337 | <STRONG>E_SYSTEM_ERROR</STRONG> |
| 338 | System error occurred (see <STRONG>errno</STRONG>). |
| 339 | |
| 340 | <STRONG>E_UNKNOWN_COMMAND</STRONG> |
| 341 | The form driver code saw an unknown request code. |
| 342 | |
| 343 | |
| 344 | </PRE> |
| 345 | <H2>SEE ALSO</H2><PRE> |
| 346 | <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="form.3x.html">form(3x)</A></STRONG>, <STRONG><A HREF="wgetch.3x.html">wgetch(3x)</A></STRONG>. |
| 347 | |
| 348 | |
| 349 | </PRE> |
| 350 | <H2>NOTES</H2><PRE> |
| 351 | The header file <STRONG><form.h></STRONG> automatically includes the header |
| 352 | files <STRONG><curses.h></STRONG>. |
| 353 | |
| 354 | |
| 355 | </PRE> |
| 356 | <H2>PORTABILITY</H2><PRE> |
| 357 | These routines emulate the System V forms library. They |
| 358 | were not supported on Version 7 or BSD versions. |
| 359 | |
| 360 | |
| 361 | </PRE> |
| 362 | <H2>AUTHORS</H2><PRE> |
| 363 | Juergen Pfeifer. Manual pages and adaptation for new |
| 364 | curses by Eric S. Raymond. |
| 365 | |
| 366 | |
| 367 | |
| 368 | <STRONG><A HREF="form_driver.3x.html">form_driver(3x)</A></STRONG> |
| 369 | </PRE> |
| 370 | <HR> |
| 371 | <ADDRESS> |
| 372 | Man(1) output converted with |
| 373 | <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a> |
| 374 | </ADDRESS> |
| 375 | </BODY> |
| 376 | </HTML> |