]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/form_field_buffer.3x
ncurses 6.0 - patch 20151219
[ncurses.git] / man / form_field_buffer.3x
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright (c) 1998-2008,2010 Free Software Foundation, Inc.              *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: form_field_buffer.3x,v 1.19 2010/12/04 18:38:55 tom Exp $
31 .TH form_field_buffer 3X ""
32 .de bP
33 .IP \(bu 4
34 ..
35 .SH NAME
36 \fBform_field_buffer\fR \- field buffer control
37 .SH SYNOPSIS
38 \fB#include <form.h>\fR
39 .sp
40 int set_field_buffer(FIELD *field, int buf, const char *value);
41 .br
42 char *field_buffer(const FIELD *field, int buffer);
43 .br
44 int set_field_status(FIELD *field, bool status);
45 .br
46 bool field_status(const FIELD *field);
47 .br
48 int set_max_field(FIELD *field, int max);
49 .br
50 .SH DESCRIPTION
51 The function \fBset_field_buffer\fR sets the numbered buffer of the given field
52 to contain a given string:
53 .RS 3
54 .bP
55 Buffer 0 is the displayed value of the field.
56 .bP
57 Other numbered buffers may be allocated by applications through the \fBnbuf\fR
58 argument of (see \fBform_field_new\fR(3X))
59 but are not manipulated by the forms library.
60 .RE
61 .PP
62 The function \fBfield_buffer\fR returns a pointer to
63 the contents of the given numbered buffer:
64 .RS 3
65 .bP
66 The buffer contents always have the same length,
67 and are padded with trailing spaces
68 as needed to ensure this length is the same.
69 .bP
70 The buffer may contain leading spaces, depending on how it was set.
71 .bP
72 The buffer contents are set with \fBset_field_buffer\fP,
73 or as a side effect of any editing operations on the corresponding field.
74 .bP
75 Editing operations are based on the \fIwindow\fP which displays the field,
76 rather than a \fIstring\fP.
77 The window contains only printable characters, and is filled with blanks.
78 If you want the raw data, you must write your
79 own routine that copies the value out of the buffer and removes the leading
80 and trailing spaces.
81 .bP
82 Because editing operations change the content of the buffer to
83 correspond to the window, you should not rely on using buffers
84 for long-term storage of form data.
85 .RE
86 .PP
87 The function \fBset_field_status\fR sets the associated status flag of
88 \fIfield\fR; \fBfield_status\fR gets the current value.  The status flag
89 is set to a nonzero value whenever the field changes.
90 .PP
91 The function \fBset_max_field\fR sets the maximum size for a dynamic field.
92 An argument of 0 turns off any maximum size threshold for that field.
93 .SH RETURN VALUE
94 The \fBfield_buffer\fR function returns NULL on error.
95 It sets errno according to their success:
96 .TP 5
97 .B E_OK
98 The routine succeeded.
99 .TP 5
100 .B E_BAD_ARGUMENT
101 Routine detected an incorrect or out-of-range argument.
102 .PP
103 The \fBfield_status\fR function returns \fBTRUE\fR or \fBFALSE\fR.
104 .PP
105 The remaining routines return one of the following:
106 .TP 5
107 .B E_OK
108 The routine succeeded.
109 .TP 5
110 .B E_SYSTEM_ERROR
111 System error occurred (see \fBerrno\fR).
112 .TP 5
113 .B E_BAD_ARGUMENT
114 Routine detected an incorrect or out-of-range argument.
115 .SH SEE ALSO
116 \fBcurses\fR(3X) and related pages whose names begin "form_" for detailed
117 descriptions of the entry points.
118 .SH NOTES
119 The header file \fB<form.h>\fR automatically includes the header file
120 .PP
121 When configured for wide characters, \fBfield_buffer\fP returns a pointer
122 to temporary storage (allocated and freed by the library).
123 The application should not attempt to modify the data.
124 It will be freed on the next call to \fBfield_buffer\fP to return the
125 same buffer.
126 \fB<curses.h>\fR.
127 .SH PORTABILITY
128 These routines emulate the System V forms library.  They were not supported on
129 Version 7 or BSD versions.
130 .SH AUTHORS
131 Juergen Pfeifer.  Manual pages and adaptation for new curses by Eric
132 S. Raymond.