form_driver.3x.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  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. </PRE>
  45. <H2>NAME</H2><PRE>
  46. <STRONG>form_driver</STRONG> - command-processing loop of the form system
  47. </PRE>
  48. <H2>SYNOPSIS</H2><PRE>
  49. <STRONG>#include</STRONG> <STRONG>&lt;form.h&gt;</STRONG>
  50. int form_driver(FORM *form, int c);
  51. </PRE>
  52. <H2>DESCRIPTION</H2><PRE>
  53. Once a form has been posted (displayed), you should funnel
  54. input events to it through <STRONG>form_driver</STRONG>. This routine has
  55. three major input cases:
  56. - The input is a form navigation request. Navigation
  57. request codes are constants defined in <STRONG>&lt;form.h&gt;</STRONG>, which
  58. are distinct from the key- and character codes returned
  59. by <STRONG>wgetch</STRONG>.
  60. - The input is a printable character. Printable charac-
  61. ters (which must be positive, less than 256) are
  62. checked according to the program's locale settings.
  63. - The input is the KEY_MOUSE special key associated with
  64. an mouse event.
  65. The form driver requests are as follows:
  66. REQ_NEXT_PAGE
  67. Move to the next page.
  68. REQ_PREV_PAGE
  69. Move to the previous page.
  70. REQ_FIRST_PAGE
  71. Move to the first page.
  72. REQ_LAST_PAGE
  73. Move to the last field.
  74. REQ_NEXT_FIELD
  75. Move to the next field.
  76. REQ_PREV_FIELD
  77. Move to the previous field.
  78. REQ_FIRST_FIELD
  79. Move to the first field.
  80. REQ_LAST_FIELD
  81. Move to the last field.
  82. REQ_SNEXT_FIELD
  83. Move to the sorted next field.
  84. REQ_SPREV_FIELD
  85. Move to the sorted previous field.
  86. REQ_SFIRST_FIELD
  87. Move to the sorted first field.
  88. REQ_SLAST_FIELD
  89. Move to the sorted last field.
  90. REQ_LEFT_FIELD
  91. Move left to a field.
  92. REQ_RIGHT_FIELD
  93. Move right to a field.
  94. REQ_UP_FIELD
  95. Move up to a field.
  96. REQ_DOWN_FIELD
  97. Move down to a field.
  98. REQ_NEXT_CHAR
  99. Move to the next char.
  100. REQ_PREV_CHAR
  101. Move to the previous char.
  102. REQ_NEXT_LINE
  103. Move to the next line.
  104. REQ_PREV_LINE
  105. Move to the previous line.
  106. REQ_NEXT_WORD
  107. Move to the next word.
  108. REQ_PREV_WORD
  109. Move to the previous word.
  110. REQ_BEG_FIELD
  111. Move to the beginning of the field.
  112. REQ_END_FIELD
  113. Move to the end of the field.
  114. REQ_BEG_LINE
  115. Move to the beginning of the line.
  116. REQ_END_LINE
  117. Move to the end of the line.
  118. REQ_LEFT_CHAR
  119. Move left in the field.
  120. REQ_RIGHT_CHAR
  121. Move right in the field.
  122. REQ_UP_CHAR
  123. Move up in the field.
  124. REQ_DOWN_CHAR
  125. Move down in the field.
  126. REQ_NEW_LINE
  127. Insert or overlay a new line.
  128. REQ_INS_CHAR
  129. Insert a blank at the cursor.
  130. REQ_INS_LINE
  131. Insert a blank line at the cursor.
  132. REQ_DEL_CHAR
  133. Delete character at the cursor.
  134. REQ_DEL_PREV
  135. Delete character before the cursor.
  136. REQ_DEL_LINE
  137. Delete line at the cursor.
  138. REQ_DEL_WORD
  139. Delete blank-delimited word at the cursor.
  140. REQ_CLR_EOL
  141. Clear to end of line from cursor.
  142. REQ_CLR_EOF
  143. Clear to end of field from cursor.
  144. REQ_CLR_FIELD
  145. Clear the entire field.
  146. REQ_OVL_MODE
  147. Enter overlay mode.
  148. REQ_INS_MODE
  149. Enter insert mode.
  150. REQ_SCR_FLINE
  151. Scroll the field forward a line.
  152. REQ_SCR_BLINE
  153. Scroll the field backward a line.
  154. REQ_SCR_FPAGE
  155. Scroll the field forward a page.
  156. REQ_SCR_BPAGE
  157. Scroll the field backward a page.
  158. REQ_SCR_FHPAGE
  159. Scroll the field forward half a page.
  160. REQ_SCR_BHPAGE
  161. Scroll the field backward half a page.
  162. REQ_SCR_FCHAR
  163. Scroll the field forward a character.
  164. REQ_SCR_BCHAR
  165. Scroll the field backward a character.
  166. REQ_SCR_HFLINE
  167. Horizontal scroll the field forward a line.
  168. REQ_SCR_HBLINE
  169. Horizontal scroll the field backward a line.
  170. REQ_SCR_HFHALF
  171. Horizontal scroll the field forward half a line.
  172. REQ_SCR_HBHALF
  173. Horizontal scroll the field backward half a line.
  174. REQ_VALIDATION
  175. Validate field.
  176. REQ_NEXT_CHOICE
  177. Display next field choice.
  178. REQ_PREV_CHOICE
  179. Display previous field choice.
  180. If the second argument is a printable character, the
  181. driver places it in the current position in the current
  182. field. If it is one of the forms requests listed above,
  183. that request is executed.
  184. <STRONG>MOUSE</STRONG> <STRONG>HANDLING</STRONG>
  185. If the second argument is the KEY_MOUSE special key, the
  186. associated mouse event is translated into one of the above
  187. pre-defined requests. Currently only clicks in the user
  188. window (e.g. inside the form display area or the decora-
  189. tion window) are handled.
  190. If you click above the display region of the form:
  191. a REQ_PREV_FIELD is generated for a single click,
  192. a REQ_PREV_PAGE is generated for a double-click and
  193. a REQ_FIRST_FIELD is generated for a triple-click.
  194. If you click below the display region of the form:
  195. a REQ_NEXT_FIELD is generated for a single click,
  196. a REQ_NEXT_PAGE is generated for a double-click and
  197. a REQ_LAST_FIELD is generated for a triple-click.
  198. If you click at an field inside the display area of the
  199. form:
  200. - the form cursor is positioned to that field.
  201. - If you double-click a field, the form cursor is
  202. positioned to that field and <STRONG>E_UNKNOWN_COMMAND</STRONG>
  203. is returned. This return value makes sense,
  204. because a double click usually means that an
  205. field-specific action should be returned. It is
  206. exactly the purpose of this return value to sig-
  207. nal that an application specific command should
  208. be executed.
  209. - If a translation into a request was done,
  210. <STRONG>form_driver</STRONG> returns the result of this request.
  211. If you clicked outside the user window or the mouse event
  212. could not be translated into a form request an
  213. <STRONG>E_REQUEST_DENIED</STRONG> is returned.
  214. <STRONG>APPLICATION-DEFINED</STRONG> <STRONG>COMMANDS</STRONG>
  215. If the second argument is neither printable nor one of the
  216. above pre-defined form requests, the driver assumes it is
  217. an application-specific command and returns <STRONG>E_UNKNOWN_COM-</STRONG>
  218. <STRONG>MAND</STRONG>. Application-defined commands should be defined rel-
  219. ative to <STRONG>MAX_COMMAND</STRONG>, the maximum value of these pre-
  220. defined requests.
  221. </PRE>
  222. <H2>RETURN VALUE</H2><PRE>
  223. <STRONG>form_driver</STRONG> returns one of the following error codes:
  224. <STRONG>E_OK</STRONG> The routine succeeded.
  225. <STRONG>E_BAD_ARGUMENT</STRONG>
  226. Routine detected an incorrect or out-of-range argu-
  227. ment.
  228. <STRONG>E_BAD_STATE</STRONG>
  229. Routine was called from an initialization or termina-
  230. tion function.
  231. <STRONG>E_NOT_POSTED</STRONG>
  232. The form has not been posted.
  233. <STRONG>E_INVALID_FIELD</STRONG>
  234. Contents of field is invalid.
  235. <STRONG>E_REQUEST_DENIED</STRONG>
  236. The form driver could not process the request.
  237. <STRONG>E_SYSTEM_ERROR</STRONG>
  238. System error occurred (see <STRONG>errno</STRONG>).
  239. <STRONG>E_UNKNOWN_COMMAND</STRONG>
  240. The form driver code saw an unknown request code.
  241. </PRE>
  242. <H2>SEE ALSO</H2><PRE>
  243. <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>.
  244. </PRE>
  245. <H2>NOTES</H2><PRE>
  246. The header file <STRONG>&lt;form.h&gt;</STRONG> automatically includes the header
  247. files <STRONG>&lt;curses.h&gt;</STRONG>.
  248. </PRE>
  249. <H2>PORTABILITY</H2><PRE>
  250. These routines emulate the System V forms library. They
  251. were not supported on Version 7 or BSD versions.
  252. </PRE>
  253. <H2>AUTHORS</H2><PRE>
  254. Juergen Pfeifer. Manual pages and adaptation for new
  255. curses by Eric S. Raymond.
  256. <STRONG><A HREF="form_driver.3x.html">form_driver(3x)</A></STRONG>
  257. </PRE>
  258. <HR>
  259. <ADDRESS>
  260. Man(1) output converted with
  261. <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
  262. </ADDRESS>
  263. </BODY>
  264. </HTML>