blob: 9cf08adb521c0c02c8a9629cb1e9d416f369829a [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
micky3879b9f5e72025-07-08 18:04:53 -04002.\" Copyright 2018-2023,2024 Thomas E. Dickey *
3.\" Copyright 1998-2010,2015 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304.\" *
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.\"
micky3879b9f5e72025-07-08 18:04:53 -040030.\" $Id: form_field_new.3x,v 1.41 2024/03/16 15:35:01 tom Exp $
31.TH form_field_new 3X 2024-03-16 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls"
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053032.SH NAME
micky3879b9f5e72025-07-08 18:04:53 -040033\fBnew_field\fP,
34\fBdup_field\fP,
35\fBlink_field\fP,
36\fBfree_field\fP \-
37create and destroy form fields
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053038.SH SYNOPSIS
micky3879b9f5e72025-07-08 18:04:53 -040039.nf
40\fB#include <form.h>
41.PP
42\fBFIELD *new_field(int \fIheight\fP, int \fIwidth\fP,
43 \fBint \fItoprow\fB, int \fIleftcol\fB,\fR
44 \fBint \fIoffscreen\fB, int \fInbuffers\fB);\fR
45\fBFIELD *dup_field(FIELD *\fIfield\fB, int \fItoprow\fB, int \fIleftcol\fB);\fR
46\fBFIELD *link_field(FIELD *\fIfield\fB, int \fItoprow\fB, int \fIleftcol\fB);\fR
47\fBint free_field(FIELD *\fIfield\fB);\fR
48.fi
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053049.SH DESCRIPTION
micky3879b9f5e72025-07-08 18:04:53 -040050The function \fBnew_field\fP allocates a new field and initializes it from the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053051parameters given: height, width, row of upper-left corner, column of upper-left
52corner, number off-screen rows, and number of additional working buffers.
53.PP
micky3879b9f5e72025-07-08 18:04:53 -040054The function \fBdup_field\fP duplicates a field at a new location.
55Most
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053056attributes (including current contents, size, validation type, buffer count,
57growth threshold, justification, foreground, background, pad character,
micky3879b9f5e72025-07-08 18:04:53 -040058options, and user pointer) are copied.
59Field status and the field page bit are
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053060not copied.
61.PP
micky3879b9f5e72025-07-08 18:04:53 -040062The function \fBlink_field\fP acts like \fBdup_field\fP, but the new field
63shares buffers with its parent.
64Attribute data is separate.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053065.PP
micky3879b9f5e72025-07-08 18:04:53 -040066The function \fBfree_field\fP de-allocates storage associated with a field.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053067.SH RETURN VALUE
micky3879b9f5e72025-07-08 18:04:53 -040068The functions \fBnew_field\fP, \fBdup_field\fP, \fBlink_field\fP return
69\fBNULL\fP on error.
70They set \fBerrno\fP according to their success:
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053071.TP 5
72.B E_OK
73The routine succeeded.
74.TP 5
75.B E_BAD_ARGUMENT
76Routine detected an incorrect or out-of-range argument.
77.TP 5
78.B E_SYSTEM_ERROR
79System error occurred, e.g., malloc failure.
80.PP
micky3879b9f5e72025-07-08 18:04:53 -040081The function \fBfree_field\fP returns one of the following:
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053082.TP 5
83.B E_OK
84The routine succeeded.
85.TP 5
86.B E_BAD_ARGUMENT
87Routine detected an incorrect or out-of-range argument.
88.TP 5
89.B E_CONNECTED
90field is connected.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053091.SH PORTABILITY
micky3879b9f5e72025-07-08 18:04:53 -040092These routines emulate the System V forms library.
93They were not supported on
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053094Version 7 or BSD versions.
95.PP
96It may be unwise to count on the set of attributes copied by
micky3879b9f5e72025-07-08 18:04:53 -040097\fBdup_field\fP being portable; the System V forms library documents are
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053098not very explicit about what gets copied and what does not.
99.SH AUTHORS
micky3879b9f5e72025-07-08 18:04:53 -0400100Juergen Pfeifer.
101Manual pages and adaptation for new curses by Eric S. Raymond.
102.SH SEE ALSO
103\fB\%curses\fP(3X),
104\fB\%form\fP(3X)