Widget...extMemo(3pm)
π Widget...extMemo(3pm) π
okay bestie, so this is a page from the User Contributed Perl Documentation β yes, the people's docs, the community-coded ones π«Ά β and it's all about a lil module called Curses::Widgets::TextMemo. sit down, grab a strawberry, we're gonna go through the whole thing together, no skips, no skimming, fr fr.
β¨ NAME β¨
Curses::Widgets::TextMemo β Text Memo Widgets π
π MODULE VERSION π
the version string, exactly as it lives in the source, no cap:
$Id: TextMemo.pm,v 1.104 2002/11/14 01:27:31 corliss Exp corliss $
π SYNOPSIS π
here's the whole vibe, copy-paste ready:
use Curses::Widgets::TextMemo;
$tm = Curses::Widgets::TextMemo->new({
CAPTION => 'Memo',
CAPTIONCOL => 'blue',
COLUMNS => 10,
MAXLENGTH => undef,
LINES => 3,
MASK => undef,
VALUE => '',
INPUTFUNC => \&scankey,
FOREGROUND => 'white',
BACKGROUND => 'black',
BORDER => 1,
BORDERCOL => 'red',
FOCUSSWITCH => "\t",
CURSORPOS => 0,
TEXTSTART => 0,
PASSWORD => 0,
X => 1,
Y => 1,
READONLY => 0,
});
$tm->draw($mwh, 1);
See the Curses::Widgets pod for other methods.
like, that last line is important β the other methods live over in the Curses::Widgets pod, this page is just the TextMemo-flavoured bits. iykyk π
π¦ REQUIREMENTS π¦
you're gonna need these two, periodt:
CursesCurses::Widgets
π DESCRIPTION π
so Curses::Widgets::TextMemo gives you simplified OO access to Curses-based single line text fields. that's the whole assignment. and the way that each object keeps its own state information? iconic. every object minds its own business, holds its own state, no drama πΈ
π METHODS π
π new (inherited from Curses::Widgets) π
$tm = Curses::Widgets::TextMemo->new({
CAPTION => 'Memo',
CAPTIONCOL => 'blue',
COLUMNS => 10,
MAXLENGTH => undef,
LINES => 3,
MASK => undef,
VALUE => '',
INPUTFUNC => \&scankey,
FOREGROUND => 'white',
BACKGROUND => 'black',
BORDER => 1,
BORDERCOL => 'red',
FOCUSSWITCH => "\t",
CURSORPOS => 0,
TEXTSTART => 0,
PASSWORD => 0,
X => 1,
Y => 1,
READONLY => 0,
});
new is the method that instantiates a brand new TextMemo object. glow-up time β¨
now listen β the only mandatory key/value pairs in that config hash are X and Y. literally just those two. everything else is optional and comes with defaults, and here's the full rundown, every single one:
CAPTIONβ defaultundefβ caption superimposed on borderCAPTIONCOLβ defaultundefβ foreground colour for caption textCOLUMNSβ default10β number of columns displayedMAXLENGTHβ defaultundefβ maximum string length allowedLINESβ default3β number of lines in the windowVALUEβ 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"β characters which signify end of inputCURSORPOSβ default0β starting position of the cursorTEXTSTARTβ default0β line number of string to start displayingPASSWORDβ default0β substitutes'*'instead of charactersREADONLYβ default0β prevents alteration to content
and some little lore you need to know π
the CAPTION is only valid when the BORDER is enabled. no border, no caption, that's the rule. but! if the border is disabled, the field gets underlined instead β provided the terminal supports it. so if your terminal isn't giving, don't come for the module π
also MAXLENGTH has no effect if you leave it undefined. so leaving it as undef = unlimited vibes, essentially.
π draw π
$tm->draw($mwh, 1);
the draw method renders the text memo in its current state. it needs a valid handle to a curses window to render itself into β that's $mwh, bestie, it can't draw on vibes alone.
and that optional second argument? if it's true, the field's text cursor gets rendered too. so 1 = cursor girlies, leave it off = no cursor π
π HISTORY π
the receipts, oldest first:
1999/12/29β Original text field widget in functional model2001/07/05β First incarnation in OO architecture
so yeah she was a functional-model girlie before she reinvented herself in OO. character development π¦
π AUTHOR/COPYRIGHT π
(c) 2001 Arthur Corliss (corliss@digitalmages.com)
and that's the whole page, bestie, nothing skipped, nothing summarised, every flag and default accounted for π«Ά
one last thing before you go: this page isperl v5.34.0, dated2022-06-12, and it lives in theWidget...extMemo(3pm)manual slot under User Contributed Perl Documentation. so when you cite it, cite it right π β¨ bye mwah! π
π¦ 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