Widget...tField(3pm)
π Widget...tField(3pm) β bestie edition π
okay so this is a page from the User Contributed Perl Documentation collection, and we're talking about Curses::Widgets::TextField. yes it's a real manual page. yes it's from 2002. yes it still slays. come sit with me π«Ά
β¨ NAME β¨
Curses::Widgets::TextField β Text Field Widgets. that's it, that's the name, she's simple and she knows it π
πΈ MODULE VERSION πΈ
$Id: TextField.pm,v 1.103 2002/11/04 00:35:44 corliss Exp corliss $
look at that version string. 1.103. iconic. no notes. β¨
π¦ SYNOPSIS π¦
here's the whole vibe, bestie β copy it, paste it, live your truth:
use Curses::Widgets::TextField;
$tf = Curses::Widgets::TextField->new({
CAPTION => 'Name',
CAPTIONCOL => 'yellow',
COLUMNS => 10,
MAXLENGTH => 255,
MASK => undef,
VALUE => '',
INPUTFUNC => \&scankey,
FOREGROUND => undef,
BACKGROUND => 'black',
BORDER => 1,
BORDERCOL => 'red',
FOCUSSWITCH => "\t\n",
CURSORPOS => 0,
TEXTSTART => 0,
PASSWORD => 0,
X => 1,
Y => 1,
READONLY => 0,
});
$tf->draw($mwh, 1);
and then, because we don't gatekeep:
See the Curses::Widgets pod for other methods.
that's where the rest of the methods live. go look. i'll wait. π
π REQUIREMENTS π
CursesCurses::Widgets
that's the whole list. two things. low maintenance queen. π
π DESCRIPTION π
so Curses::Widgets::TextField gives you simplified OO access to Curses-based single line text fields. and the way that each object maintains its own state information? obsessed. every field is its own little main character with its own memory. no sharing, no chaos, just vibes β¨
π METHODS π
π new (inherited from Curses::Widgets)
$tf = Curses::Widgets::TextField->new({
CAPTION => 'Name',
CAPTIONCOL => 'yellow',
COLUMNS => 10,
MAXLENGTH => 255,
MASK => undef,
VALUE => '',
INPUTFUNC => \&scankey,
FOREGROUND => undef,
BACKGROUND => 'black',
BORDER => 1,
BORDERCOL => 'red',
FOCUSSWITCH => "\t\n",
CURSORPOS => 0,
TEXTSTART => 0,
PASSWORD => 0,
X => 1,
Y => 1,
READONLY => 0,
});
new instantiates a brand new TextField object, fr fr. now listen β the only mandatory key/value pairs in that config hash are X and Y. that's it. everything else? optional, babes, and here's what they all default to:
CAPTIONβ defaultundefβ caption superimposed on the borderCAPTIONCOLβ defaultundefβ foreground colour for caption textCOLUMNSβ default10β number of columns displayedMAXLENGTHβ default255β maximum string length allowedMASKβ defaultundefβ not yet implementedVALUEβ default''β current field textINPUTFUNCβ default\&scankeyβ function to use to scan for keystrokesFOREGROUNDβ defaultundefβ default foreground colourBACKGROUNDβ defaultundefβ default background colourBORDERβ default1β display a border around the fieldBORDERCOLβ defaultundefβ foreground colour for borderFOCUSSWITCHβ default"\t\n"β characters which signify end of inputCURSORPOSβ default0β starting position of the cursorTEXTSTARTβ default0β position in string to start displayingPASSWORDβ default0β subsitutes'*'instead of charactersREADONLYβ default0β prevents alteration to content
a few little lore drops for you, bestie:
- the
CAPTIONis only valid when theBORDERis enabled. if the border is disabled, the field will be underlined β provided the terminal supports it. so like, terminal-dependent, iykyk π§ - if
MAXLENGTHis undefined, no limit will be placed on the string length. go off, type forever, no one's stopping you π - if
BORDERis true, the widget will be enlarged to three columns and two more columns to make room for the border. she's taking up space because she deserves it π
β draw β
$tf->draw($mwh, 1);
draw renders the text field in its current state. this requires a valid handle to a curses window in which it will render itself. and that optional second argument? if it's true, the field's text cursor gets rendered as well. cursor said "i'm here too" π«Ά
π HISTORY π
1999/12/29β original text field widget in functional model2001/07/05β first incarnation in OO architecture
she's been evolving since '99. a glow-up arc for the ages. β¨
π AUTHOR/COPYRIGHT π
(c) 2001 Arthur Corliss (corliss@digitalmages.com)
respect the author, bestie. π«‘
okay and for the cute sign-off β this was perl v5.34.0, dated 2022-06-12, and the page header/footer said Widget...tField(3pm) all along. that's the whole thing! go build a text field, you've got this πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- debian bookworm: libcurses-widgets-perl 1.997-8
- debian trixie: libcurses-widgets-perl 1.997-8
- ubuntu noble: libcurses-widgets-perl 1.997-8
- ubuntu resolute: libcurses-widgets-perl 1.997-8
- ubuntu stonking: libcurses-widgets-perl 1.997-8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms