]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/form_field_buffer.3x
ncurses 6.2 - patch 20200516
[ncurses.git] / man / form_field_buffer.3x
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright 2018-2019,2020 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 .\"
31 .\" $Id: form_field_buffer.3x,v 1.26 2020/03/28 19:06:28 tom Exp $
32 .TH form_field_buffer 3X ""
33 .ie \n(.g .ds `` \(lq
34 .el       .ds `` ``
35 .ie \n(.g .ds '' \(rq
36 .el       .ds '' ''
37 .de bP
38 .ie n  .IP \(bu 4
39 .el    .IP \(bu 2
40 ..
41 .SH NAME
42 \fBform_field_buffer\fR \- field buffer control
43 .SH SYNOPSIS
44 \fB#include <form.h>\fR
45 .sp
46 int set_field_buffer(FIELD *field, int buf, const char *value);
47 .br
48 char *field_buffer(const FIELD *field, int buffer);
49 .br
50 int set_field_status(FIELD *field, bool status);
51 .br
52 bool field_status(const FIELD *field);
53 .br
54 int set_max_field(FIELD *field, int max);
55 .br
56 .SH DESCRIPTION
57 The function \fBset_field_buffer\fR sets the numbered buffer of the given field
58 to contain a given string:
59 .RS 3
60 .bP
61 Buffer 0 is the displayed value of the field.
62 .bP
63 Other numbered buffers may be allocated by applications through the \fBnbuf\fR
64 argument of (see \fBform_field_new\fR(3X))
65 but are not manipulated by the forms library.
66 .RE
67 .PP
68 The function \fBfield_buffer\fR returns a pointer to
69 the contents of the given numbered buffer:
70 .RS 3
71 .bP
72 The buffer contents always have the same length,
73 and are padded with trailing spaces
74 as needed to ensure this length is the same.
75 .bP
76 The buffer may contain leading spaces, depending on how it was set.
77 .bP
78 The buffer contents are set with \fBset_field_buffer\fP,
79 or as a side effect of any editing operations on the corresponding field.
80 .bP
81 Editing operations are based on the \fIwindow\fP which displays the field,
82 rather than a \fIstring\fP.
83 The window contains only printable characters, and is filled with blanks.
84 If you want the raw data, you must write your
85 own routine that copies the value out of the buffer and removes the leading
86 and trailing spaces.
87 .bP
88 Because editing operations change the content of the buffer to
89 correspond to the window, you should not rely on using buffers
90 for long-term storage of form data.
91 .RE
92 .PP
93 The function \fBset_field_status\fR sets the associated status flag of
94 \fIfield\fR; \fBfield_status\fR gets the current value.
95 The status flag
96 is set to a nonzero value whenever the field changes.
97 .PP
98 The function \fBset_max_field\fR sets the maximum size for a dynamic field.
99 An argument of 0 turns off any maximum size threshold for that field.
100 .SH RETURN VALUE
101 The \fBfield_buffer\fR function returns NULL on error.
102 It sets \fBerrno\fP according to their success:
103 .TP 5
104 .B E_OK
105 The routine succeeded.
106 .TP 5
107 .B E_BAD_ARGUMENT
108 Routine detected an incorrect or out-of-range argument.
109 .PP
110 The \fBfield_status\fR function returns \fBTRUE\fR or \fBFALSE\fR.
111 .PP
112 The remaining routines return one of the following:
113 .TP 5
114 .B E_OK
115 The routine succeeded.
116 .TP 5
117 .B E_SYSTEM_ERROR
118 System error occurred (see \fBerrno\fR(3)).
119 .TP 5
120 .B E_BAD_ARGUMENT
121 Routine detected an incorrect or out-of-range argument.
122 .SH SEE ALSO
123 \fBcurses\fR(3X) and related pages whose names begin \*(``form_\*('' for detailed
124 descriptions of the entry points.
125 .SH NOTES
126 The header file \fB<form.h>\fR automatically includes the header file
127 .PP
128 When configured for wide characters, \fBfield_buffer\fP returns a pointer
129 to temporary storage (allocated and freed by the library).
130 The application should not attempt to modify the data.
131 It will be freed on the next call to \fBfield_buffer\fP to return the
132 same buffer.
133 \fB<curses.h>\fR.
134 .SH PORTABILITY
135 These routines emulate the System V forms library.
136 They were not supported on
137 Version 7 or BSD versions.
138 .PP
139 The \fBset_max_field\fP function checks for an ncurses extension
140 \fBO_INPUT_FIELD\fP which allows a dynamic field to shrink if the new
141 limit is smaller than the current field size.
142 .SH AUTHORS
143 Juergen Pfeifer.
144 Manual pages and adaptation for new curses by Eric S. Raymond.