Widget...extMemo(3pm)

πŸ“¦
version 1.997 Β· 2 versions
  • 1.997 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.997 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– 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:

  • Curses
  • Curses::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 β€” default undef β€” caption superimposed on border
  • CAPTIONCOL β€” default undef β€” foreground colour for caption text
  • COLUMNS β€” default 10 β€” number of columns displayed
  • MAXLENGTH β€” default undef β€” maximum string length allowed
  • LINES β€” default 3 β€” number of lines in the window
  • VALUE β€” default '' β€” current field text
  • INPUTFUNC β€” default \&scankey β€” function to use to scan for keystrokes
  • FOREGROUND β€” default undef β€” default foreground colour
  • BACKGROUND β€” default undef β€” default background colour
  • BORDER β€” default 1 β€” display a border around the field
  • BORDERCOL β€” default undef β€” foreground colour for border
  • FOCUSSWITCH β€” default "\t" β€” characters which signify end of input
  • CURSORPOS β€” default 0 β€” starting position of the cursor
  • TEXTSTART β€” default 0 β€” line number of string to start displaying
  • PASSWORD β€” default 0 β€” substitutes '*' instead of characters
  • READONLY β€” default 0 β€” 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 model
  • 2001/07/05 β€” First incarnation in OO architecture

so yeah she was a functional-model girlie before she reinvented herself in OO. character development πŸ¦‹

(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 is perl v5.34.0, dated 2022-06-12, and it lives in the Widget...extMemo(3pm) manual slot under User Contributed Perl Documentation. so when you cite it, cite it right πŸ’…βœ¨ bye mwah! πŸ’–