Widgets::ListBox(3pm)
π NAME π
Curses::Widgets::ListBox β List Box Widgets, bestie. That's the whole vibe. π
π MODULE VERSION π
$Id: ListBox.pm,v 1.104 2002/11/14 01:20:28 corliss Exp corliss $
no cap, that's the version string, keep it safe π«Ά
β¨ SYNOPSIS β¨
okay so this is how you actually summon one:
use Curses::Widgets::ListBox;
$lb = Curses::Widgets::ListBox->new({
CAPTION => 'List',
CAPTIONCOL => 'yellow',
COLUMNS => 10,
LINES => 3,
VALUE => 0,
INPUTFUNC => \&scankey,
FOREGROUND => 'white',
BACKGROUND => 'black',
SELECTEDCOL => 'green',
BORDER => 1,
BORDERCOL => 'red',
FOCUSSWITCH => "\t",
X => 1,
Y => 1,
TOPELEMENT => 0,
LISTITEMS => [@list],
});
$lb->draw($mwh, 1);
then likeβ¦ go read the Curses::Widgets pod for the other methods, because there's more where that came from π
π REQUIREMENTS π
CursesCurses::Widgets
you need both, fr fr. no skipping.
π¦ DESCRIPTION π¦
Curses::Widgets::ListBox gives you simplified OO access to Curses-based single-select and multi-select list boxes. literally that's the whole job. and the way each object maintains its own state information?? obsessed. every single one is its own little main character with its own state. π
π METHODS π
πΈ new (inherited from Curses::Widgets)
$tm = Curses::Widgets::ListBox->new({
CAPTION => 'List',
CAPTIONCOL => 'yellow',
COLUMNS => 10,
LINES => 3,
VALUE => 0,
INPUTFUNC => \&scankey,
FOREGROUND => 'white',
BACKGROUND => 'black',
SELECTEDCOL => 'green',
BORDER => 1,
BORDERCOL => 'red',
FOCUSSWITCH => "\t",
X => 1,
Y => 1,
TOPELEMENT => 0,
LISTITEMS => [@list],
});
the new method instantiates a new ListBox object. and bestie, listen β the only mandatory key/value pairs in that config hash are X and Y. everything else? optional, they've all got defaults waiting for you like the loyal besties they are:
CAPTIONβ defaultundefβ Caption superimposed on borderCAPTIONCOLβ defaultundefβ Foreground colour for caption textCOLUMNSβ default10β Number of columns displayedLINESβ default3β Number of lines in the windowINPUTFUNCβ default\&scankeyβ Function to use to scan for keystrokesFOREGROUNDβ defaultundefβ Default foreground colourBACKGROUNDβ defaultundefβ Default background colourSELECTEDCOLβ defaultundefβ Default colour of selected itemsBORDERβ default1β Display a border around the fieldBORDERCOLβ defaultundefβ Foreground colour for borderFOCUSSWITCHβ default"\t"β Characters which signify end of inputTOPELEMENTβ default0β Index of element displayed on line 1LISTITEMSβ default[]β List of list itemsMULTISELβ default0β Whether or not multiple items can be selectedTOGGLEβ default"\n\s"β What input toggles selection of the current itemVALUEβ default0 or []β Index(es) of selected itemsCURSORPOSβ default0β Index of the item the cursor is currently on
the CAPTION is only valid when the BORDER is enabled. if the border is disabled, the field will be underlined β provided the terminal supports it. so like, vibe check your terminal first π«Ά
and about VALUE: it should be an array reference when you're in multiple selection mode. otherwise it should either be undef or an integer. periodt. β¨
π draw
$lb->draw($mwh, 1);
the draw method renders the list box in its current state. it needs a valid handle to a curses window to render itself into β non-negotiable, that's the whole stage. π
the optional second argument, if it's true, will also cause the field's text cursor to be rendered. cute little bonus. π
π HISTORY π
1999/12/29β Original list box widget in functional model2001/07/05β First incarnation in OO architecture
look at the glow-up. we love an evolution arc. π¦β¨
π AUTHOR/COPYRIGHT π
(c) 2001 Arthur Corliss (corliss@digitalmages.com)
and that's a wrap, bestie π this was Widgets::ListBox(3pm), generated by perl v5.34.0 on 2022-06-12 β go forth and render some gorgeous little list boxes, iykyk πππ
π¦ 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