Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 2 | .\" Copyright 2018-2023,2024 Thomas E. Dickey * |
| 3 | .\" Copyright 1998-2010,2015 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | .\" |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 30 | .\" $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 Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 32 | .SH NAME |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 33 | \fBnew_field\fP, |
| 34 | \fBdup_field\fP, |
| 35 | \fBlink_field\fP, |
| 36 | \fBfree_field\fP \- |
| 37 | create and destroy form fields |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 38 | .SH SYNOPSIS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 39 | .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 Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 49 | .SH DESCRIPTION |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 50 | The function \fBnew_field\fP allocates a new field and initializes it from the |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 51 | parameters given: height, width, row of upper-left corner, column of upper-left |
| 52 | corner, number off-screen rows, and number of additional working buffers. |
| 53 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 54 | The function \fBdup_field\fP duplicates a field at a new location. |
| 55 | Most |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 56 | attributes (including current contents, size, validation type, buffer count, |
| 57 | growth threshold, justification, foreground, background, pad character, |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 58 | options, and user pointer) are copied. |
| 59 | Field status and the field page bit are |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 60 | not copied. |
| 61 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 62 | The function \fBlink_field\fP acts like \fBdup_field\fP, but the new field |
| 63 | shares buffers with its parent. |
| 64 | Attribute data is separate. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 65 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 66 | The function \fBfree_field\fP de-allocates storage associated with a field. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 67 | .SH RETURN VALUE |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 68 | The functions \fBnew_field\fP, \fBdup_field\fP, \fBlink_field\fP return |
| 69 | \fBNULL\fP on error. |
| 70 | They set \fBerrno\fP according to their success: |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 71 | .TP 5 |
| 72 | .B E_OK |
| 73 | The routine succeeded. |
| 74 | .TP 5 |
| 75 | .B E_BAD_ARGUMENT |
| 76 | Routine detected an incorrect or out-of-range argument. |
| 77 | .TP 5 |
| 78 | .B E_SYSTEM_ERROR |
| 79 | System error occurred, e.g., malloc failure. |
| 80 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 81 | The function \fBfree_field\fP returns one of the following: |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 82 | .TP 5 |
| 83 | .B E_OK |
| 84 | The routine succeeded. |
| 85 | .TP 5 |
| 86 | .B E_BAD_ARGUMENT |
| 87 | Routine detected an incorrect or out-of-range argument. |
| 88 | .TP 5 |
| 89 | .B E_CONNECTED |
| 90 | field is connected. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 91 | .SH PORTABILITY |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 92 | These routines emulate the System V forms library. |
| 93 | They were not supported on |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 94 | Version 7 or BSD versions. |
| 95 | .PP |
| 96 | It may be unwise to count on the set of attributes copied by |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 97 | \fBdup_field\fP being portable; the System V forms library documents are |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 98 | not very explicit about what gets copied and what does not. |
| 99 | .SH AUTHORS |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame^] | 100 | Juergen Pfeifer. |
| 101 | Manual pages and adaptation for new curses by Eric S. Raymond. |
| 102 | .SH SEE ALSO |
| 103 | \fB\%curses\fP(3X), |
| 104 | \fB\%form\fP(3X) |