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