]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/html/form_fieldtype.3x.html
ncurses 4.1
[ncurses.git] / Ada95 / html / form_fieldtype.3x.html
1 <HTML>
2 <BODY BGCOLOR="#99ccbb" TEXT="#000000" LINK="#4060b0" VLINK="#000080" ALINK="#ff4040">
3 <PRE>
4        <STRONG>form_fieldtype</STRONG> - define validation-field types
5
6
7 </PRE>
8 <H2>SYNOPSIS</H2><PRE>
9        <STRONG>#include</STRONG> <STRONG>&lt;form.h&gt;</STRONG>
10        FIELDTYPE *new_fieldtype(
11            bool (* const field_check)(FIELD *, const void *),
12            bool (* const char_check)(int, const void *));
13        int free_fieldtype(FIELDTYPE *fieldtype);
14        int set_fieldtype_arg(
15            FIELDTYPE *fieldtype,
16            void *(* const make_arg)(va_list *),
17            void *(* const copy_arg)(const void *),
18            void  (* const free_arg)(void *));
19        int set_fieldtype_choice(
20            FIELDTYPE *fieldtype
21            bool (* const next_choice)(FIELD *, const void *),
22            bool (* const prev_choice)(FIELD *, const void *));
23        FIELDTYPE *link_fieldtype(FIELDTYPE *type1,
24                                  FIELDTYPE *type2);
25
26
27 </PRE>
28 <H2>DESCRIPTION</H2><PRE>
29        The function <STRONG>new_fieldtype</STRONG> creates a new field type usable
30        for data validation.  You supply it  with  <EM>field</EM><STRONG>_</STRONG><EM>check</EM>,  a
31        predicate  to check the validity of an entered data string
32        whenever the user attempt to leave a field.  The (FIELD *)
33        argument  is passed in so the validation predicate can see
34        the field's buffer, sizes and other attributes; the second
35        argument  is an argument-block structure, about which more
36        below.
37
38        You also supply <STRONG>new_fieldtype</STRONG> with <EM>char</EM><STRONG>_</STRONG><EM>check</EM>, a  function
39        to  validate input characters as they are entered; it will
40        be passed the character to be checked and a pointer to  an
41        argument-block structure.
42
43        The  function <STRONG>free_fieldtype</STRONG> frees the space allocated for
44        a given validation type.
45
46        The function <STRONG>set_fieldtype</STRONG> associates  three  storage-man-
47        agement functions with a field type.  The <EM>mak</EM><STRONG>_</STRONG><EM>arg</EM> function
48        is automatically applied to the list of arguments you give
49        <STRONG>set_field_type</STRONG>  when  attaching validation to a field; its
50        job is to bundle these into  an  allocated  argument-block
51        object which can later be passed to validation predicated.
52        The other two hook arguments should copy  and  free  argu-
53        ment-block  structures.   They  will be used by the forms-
54        driver code.
55
56        The   form    driver    requests    <STRONG>REQ_NEXT_CHOICE</STRONG>    and
57        <STRONG>REQ_PREV_CHOICE</STRONG> assume that the possible values of a field
58        form an ordered set, and provide the forms user with a way
59        to  move  through the set.  The <STRONG>set_fieldtype_choice</STRONG> func-
60        take the field pointer and an argument-block structure  as
61        arguments.
62
63
64 </PRE>
65 <H2>RETURN VALUE</H2><PRE>
66        The pointer-valued routines return NULL on error.
67
68        The  integer-valued  routines  return one of the following
69        codes on error:
70
71        <STRONG>E_OK</STRONG> The routine succeeded.
72
73        <STRONG>E_SYSTEM_ERROR</STRONG>
74             System error occurred (see <STRONG>errno</STRONG>).
75
76        <STRONG>E_BAD_ARGUMENT</STRONG>
77             Routine detected an incorrect or  out-of-range  argu-
78             ment.
79
80        <STRONG>E_CONNECTED</STRONG>
81             The field is already connected to a form.
82
83
84 </PRE>
85 <H2>SEE ALSO</H2><PRE>
86        <STRONG><A HREF="ncurses.3x.html">curses(3X)</A></STRONG>, <STRONG><A HREF="form.3x.html">form(3X)</A></STRONG>.
87
88
89 </PRE>
90 <H2>NOTES</H2><PRE>
91        The header file <STRONG>&lt;form.h&gt;</STRONG> automatically includes the header
92        file <STRONG>&lt;curses.h&gt;</STRONG>.
93
94        All of the <STRONG>(char</STRONG> <STRONG>*)</STRONG> arguments of  these  functions  should
95        actually  be <STRONG>(void</STRONG> <STRONG>*)</STRONG>.  The type has been left uncorrected
96        for strict compatibility with System V.
97
98
99 </PRE>
100 <H2>PORTABILITY</H2><PRE>
101        These routines emulate the System V forms  library.   They
102        were not supported on Version 7 or BSD versions.
103
104
105 </PRE>
106 <H2>AUTHORS</H2><PRE>
107        Juergen  Pfeifer.   Manual  pages  and  adaptation for new
108        curses by Eric S. Raymond.
109
110
111
112
113
114
115
116
117
118
119
120
121
122 </PRE>
123 </BODY>
124 </HTML>