]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/form_field_buffer.3x.html
ncurses 6.4 - patch 20231217
[ncurses.git] / doc / html / man / form_field_buffer.3x.html
1 <!--
2   ****************************************************************************
3   * Copyright 2018-2022,2023 Thomas E. Dickey                                *
4   * Copyright 1998-2010,2017 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_field_buffer.3x,v 1.43 2023/12/16 20:32:22 tom Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>form_field_buffer 3x 2023-12-16 ncurses 6.4 Library calls</TITLE>
38 <link rel="author" href="mailto:bug-ncurses@gnu.org">
39
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">form_field_buffer 3x 2023-12-16 ncurses 6.4 Library calls</H1>
43 <PRE>
44 <STRONG><A HREF="form_field_buffer.3x.html">form_field_buffer(3x)</A></STRONG>            Library calls           <STRONG><A HREF="form_field_buffer.3x.html">form_field_buffer(3x)</A></STRONG>
45
46
47
48
49 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
50        <STRONG>form_field_buffer</STRONG> - field buffer control
51
52
53 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
54        <STRONG>#include</STRONG> <STRONG>&lt;form.h&gt;</STRONG>
55
56        <STRONG>int</STRONG> <STRONG>set_field_buffer(FIELD</STRONG> <STRONG>*</STRONG><EM>field</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>buf</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>value</EM><STRONG>);</STRONG>
57        <STRONG>char</STRONG> <STRONG>*field_buffer(const</STRONG> <STRONG>FIELD</STRONG> <STRONG>*</STRONG><EM>field</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>buffer</EM><STRONG>);</STRONG>
58
59        <STRONG>int</STRONG> <STRONG>set_field_status(FIELD</STRONG> <STRONG>*</STRONG><EM>field</EM><STRONG>,</STRONG> <STRONG>bool</STRONG> <EM>status</EM><STRONG>);</STRONG>
60        <STRONG>bool</STRONG> <STRONG>field_status(const</STRONG> <STRONG>FIELD</STRONG> <STRONG>*</STRONG><EM>field</EM><STRONG>);</STRONG>
61
62        <STRONG>int</STRONG> <STRONG>set_max_field(FIELD</STRONG> <STRONG>*</STRONG><EM>field</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>max</EM><STRONG>);</STRONG>
63
64
65 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
66        The  function  <STRONG>set_field_buffer</STRONG>  sets  the numbered buffer of the given
67        field to contain a given string:
68
69           <STRONG>o</STRONG>   Buffer 0 is the displayed value of the field.
70
71           <STRONG>o</STRONG>   Other numbered buffers may be allocated by applications  through
72               the  <STRONG>nbuf</STRONG>  argument  of  (see  <STRONG><A HREF="form_field_new.3x.html">form_field_new(3x)</A></STRONG>)  but  are not
73               manipulated by the forms library.
74
75        The function <STRONG>field_buffer</STRONG> returns a pointer  to  the  contents  of  the
76        given numbered buffer:
77
78           <STRONG>o</STRONG>   The  buffer contents always have the same length, and are padded
79               with trailing spaces as needed to  ensure  this  length  is  the
80               same.
81
82           <STRONG>o</STRONG>   The  buffer  may contain leading spaces, depending on how it was
83               set.
84
85           <STRONG>o</STRONG>   The buffer contents are set with <STRONG>set_field_buffer</STRONG>, or as a  side
86               effect of any editing operations on the corresponding field.
87
88           <STRONG>o</STRONG>   Editing  operations  are  based on the <EM>window</EM> which displays the
89               field, rather than a <EM>string</EM>.  The window contains only printable
90               characters,  and  is  filled  with  blanks.  If you want the raw
91               data, you must write your own routine that copies the value  out
92               of the buffer and removes the leading and trailing spaces.
93
94           <STRONG>o</STRONG>   Because  editing  operations change the content of the buffer to
95               correspond to the window, you should not rely on  using  buffers
96               for long-term storage of form data.
97
98        The function <STRONG>set_field_status</STRONG> sets the associated status flag of <EM>field</EM>;
99        <STRONG>field_status</STRONG> gets the current value.  The  status  flag  is  set  to  a
100        nonzero value whenever the field changes.
101
102        The  function  <STRONG>set_max_field</STRONG> sets the maximum size for a dynamic field.
103        An argument of 0 turns off any maximum size threshold for that field.
104
105
106 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
107        The <STRONG>field_buffer</STRONG>  function  returns  NULL  on  error.   It  sets  <STRONG>errno</STRONG>
108        according to their success:
109
110        <STRONG>E_OK</STRONG> The routine succeeded.
111
112        <STRONG>E_BAD_ARGUMENT</STRONG>
113             Routine detected an incorrect or out-of-range argument.
114
115        The <STRONG>field_status</STRONG> function returns <STRONG>TRUE</STRONG> or <STRONG>FALSE</STRONG>.
116
117        The remaining routines return one of the following:
118
119        <STRONG>E_OK</STRONG> The routine succeeded.
120
121        <STRONG>E_SYSTEM_ERROR</STRONG>
122             System error occurred (see <STRONG>errno(3)</STRONG>).
123
124        <STRONG>E_BAD_ARGUMENT</STRONG>
125             Routine detected an incorrect or out-of-range argument.
126
127
128 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
129        When  configured for wide characters, <STRONG>field_buffer</STRONG> returns a pointer to
130        temporary  storage  (allocated  and  freed  by   the   library).    The
131        application should not attempt to modify the data.  It will be freed on
132        the next call to <STRONG>field_buffer</STRONG> to return the same buffer.
133
134
135 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
136        These routines emulate the System  V  forms  library.   They  were  not
137        supported on Version 7 or BSD versions.
138
139        The   <STRONG>set_max_field</STRONG>   function   checks   for   an   <EM>ncurses</EM>  extension
140        <STRONG>O_INPUT_FIELD</STRONG> which allows a dynamic field to shrink if the  new  limit
141        is smaller than the current field size.
142
143
144 </PRE><H2><a name="h2-AUTHORS">AUTHORS</a></H2><PRE>
145        Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric S.
146        Raymond.
147
148
149 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
150        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG> and related pages whose names  begin  "form_"  for  detailed
151        descriptions of the entry points.
152
153
154
155 ncurses 6.4                       2023-12-16             <STRONG><A HREF="form_field_buffer.3x.html">form_field_buffer(3x)</A></STRONG>
156 </PRE>
157 <div class="nav">
158 <ul>
159 <li><a href="#h2-NAME">NAME</a></li>
160 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
161 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li>
162 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
163 <li><a href="#h2-NOTES">NOTES</a></li>
164 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
165 <li><a href="#h2-AUTHORS">AUTHORS</a></li>
166 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
167 </ul>
168 </div>
169 </BODY>
170 </HTML>