Curses::Widgets::ButtonSet(3pm)

Curses::Widgets::ButtonSet3pm

Button set widgets

Usage

  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.

Module version

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

Requirements

Curses
Curses::Widgets

Overview

Curses::Widgets::ButtonSet provides 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 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

The last option, PADDING, is only applicable to horizontal sets without borders.

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).

Releases

11 releases since Debian 3.1 (Sarge); the text changed 4 times.

  1. 3.1
  2. 4.0–7
  3. 8
  4. 9–11
  5. 12–13

History

1999/12/29 Ω- Original button set widget in functional model
2001/07/05 Ω- First incarnation in OO architecture

From libcurses-widgets-perl 1.997-8 in Debian 13 (Trixie). Parsed by carta from the page's man source.