Widget...tonSet(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

πŸ’– NAME πŸ’–

Curses::Widgets::ButtonSet β€” Button Set Widgets, bestie ✨

It's giving "buttons, but make it Curses." πŸŽ€


🌸 MODULE VERSION 🌸

$Id: ButtonSet.pm,v 1.103 2002/11/03 23:31:26 corliss Exp corliss $

Version string in the chat, periodt. πŸ’…


✨ SYNOPSIS ✨

use Curses::Widgets::ButtonSet;

$btns = Curses::Widgets::ButtonSet->({
  LENGTH      => 10,
  VALUE       => 0,
  INPUTFUNC   => \&scankey,
  FOREGROUND  => 'white',
  BACKGROUND  => 'black',
  BORDER      => 1,
  BORDERCOL   => 'red',
  FOCUSSWITCH => "\t\n",
  HORIZONTAL  => 1,
  PADDING     => 1,
  X           => 1,
  Y           => 1,
  LABELS      => [qw(OK CANCEL)],
  });

$btns->draw($mwh, 1);

See the Curses::Widgets pod for other methods.

That's the whole vibe right there. πŸ¦‹


🌈 REQUIREMENTS 🌈

  • Curses
  • Curses::Widgets

You need both, no skipping, fr fr. πŸ™ˆ


πŸ’œ DESCRIPTION πŸ’œ

Curses::Widgets::ButtonSet gives you simplified OO access to Curses-based button sets. Each object maintains it's own state information. 🌸


πŸ‘‘ METHODS πŸ‘‘

πŸŽ€ new (inherited from Curses::Widgets)

$btns = Curses::Widgets::ButtonSet->({
  LENGTH      => 10,
  VALUE       => 0,
  INPUTFUNC   => \&scankey,
  FOREGROUND  => 'white',
  BACKGROUND  => 'black',
  BORDER      => 1,
  BORDERCOL   => 'red',
  FOCUSSWITCH => "\t\n",
  HORIZONTAL  => 1,
  PADDING     => 1,
  X           => 1,
  Y           => 1,
  LABELS      => [qw(OK CANCEL)],
  });

The new method instantiates a new ButtonSet object. The only mandatory key/value pairs in the configuration hash are X, Y, and LABELS. All the others have the following defaults:

Key         Default    Description
============================================================
LENGTH             10  Number of columns for each button label
VALUE               0  Button selected (0-based indexing)
INPUTFUNC   \&scankey  Function to use to scan for keystrokes
FOREGROUND      undef  Default foreground colour
BACKGROUND      undef  Default blackground colour
BORDER              1  Display border around the set
BORDERCOL       undef  Foreground colour for border
FOCUSSWITCH    "\t\n"  Characters which signify end of input
HORIZONTAL          1  Horizontal orientation for set
PADDING             1  Number of spaces between buttons

Little note, bestie: the last option, PADDING, is only applicable to horizontal sets without borders. πŸ’€ So don't come crying to me when it does nothing on your bordered set, iykyk.


πŸ¦‹ draw

$btns->draw($mwh, 1);

The draw method renders the button set in its current state. This requires a valid handle to a curses window in which it will render itself. The optional second argument, if true, will cause the set's selected button to be rendered in standout mode (inverse video). βœ¨πŸ‘‘


πŸ“œ HISTORY πŸ“œ

  • 1999/12/29 β€” Original button set widget in functional model
  • 2001/07/05 β€” First incarnation in OO architecture

She's been iconic since '99, no cap. πŸ’–


(c) 2001 Arthur Corliss (corliss@digitalmages.com)


okay so that's literally the whole thing, bestie πŸ’… This was Widget...tonSet(3pm), part of the User Contributed Perl Documentation, shipped with perl v5.34.0 and dated 2022-06-12. Love that for us. πŸŽ€βœ¨πŸ¦‹ bye bestie! πŸ‘‘πŸ’œ