CursesWidgets

 view release on metacpan or  search on metacpan

test.pl  view on Meta::CPAN

  });
$descriptions[4] = << '__EOF__';
Curses::Widgets::ProgressBar -- Horizontal progress bar with border.

Please wait until the bar progresses to 100%.
__EOF__

$p = << "__EOF__";
This is an example memo that uses the Widgets class textwrap function to split
according to whitespace and column limits.
__EOF__

$widgets[5] = Curses::Widgets::TextMemo->new({
  Y           => 10,
  X           => 14,
  COLUMNS     => 20,
  FOREGROUND  => 'green',
  BACKGROUND  => 'blue',
  VALUE       => $p,
  BORDERCOL   => 'black',
  BORDER      => 1,
  CAPTION     => 'Test Memo',
  CAPTIONCOL  => 'yellow',
  });
$descriptions[5] = << '__EOF__';
Curses::Widgets::TextMemo -- Text memo with a border and caption.

Press <RETURN> or <TAB> to move to the next widget (set).
__EOF__

$widgets[6] = Curses::Widgets::ListBox->new({
  Y           => 2,
  X           => 38,
  COLUMNS     => 20,
  LISTITEMS   => ['Ham', 'Eggs', 'Cheese', 'Hash Browns', 'Toast'],
  MULTISEL    => 1,
  VALUE       => [0, 2],
  SELECTEDCOL => 'green',
  CAPTION     => 'List Box',
  CAPTIONCOL  => 'yellow',
  });
$descriptions[6] = << '__EOF__';
Curses::Widgets::ListBox -- This list box supports multiple and single selection modes.  Use <SPACE> or <RETURN> to toggle a selection.

Press <TAB> to move to the next widget (set).
__EOF__

$widgets[7] = Curses::Widgets::Calendar->new({
  Y             => 7,
  X             => 38,
  FOREGROUND    => 'black',
  BACKGROUND    => 'white',
  BORDER        => 1,
  CAPTION       => 'Appointments',
  CAPTIONCOL    => 'blue',
  HIGHLIGHT     => [1, 5, 17, 26],
  HIGHLIGHTCOL  => 'green',
  HEADERCOL     => 'red',
  });
$descriptions[7] = << '__EOF__';
Curses::Widgets::Calendar -- This calendar supports date highlighting and broad navigation capabilities.

Press <TAB> to move to the next widget (set).
__EOF__

$widgets[8] = Curses::Widgets::ComboBox->new({
  Y           => 3,
  X           => 62,
  FOREGROUND  => 'white',
  BACKGROUND  => 'red',
  LISTITEMS   => [qw(Mr. Mrs. Ms.)],
  COLUMNS     => 4,
  BORDER      => 1,
  });
$descriptions[8] = << '__EOF__';
Curses::Widgets::ComboBox -- This is a text field that also has a drop-down list to select values from.  Just press the down arrow.

Press <TAB> to move to the next widget (set).
__EOF__

# Draw each of the widgets
foreach (@widgets) { $_->draw($mwh) };
comment_box();

# Interactively demonstrate each widget
for ($i = 0; $i < scalar @widgets; $i++) { 
  comment_box($descriptions[$i]);
  if (ref($widgets[$i]) !~ /Progress/) {
    $widgets[$i]->execute($mwh);
    $widgets[$i]->draw($mwh);
  } else {
    while ($widgets[$i]->getField('VALUE') <
      $widgets[$i]->getField('MAX')) {
      $widgets[$i]->input(30);
      $widgets[$i]->draw($mwh);
      sleep 1;
    }
  }
}

# Label description
comment_box(<< '__EOF__');
This comment box has been demonstrating the use of the Curses::Widgets::Label.  Labels support left, centered, and right alignments, and with and without borders.

Press any key to continue.
__EOF__
scankey($mwh);

# Parting comments
comment_box(<< '__EOF__');
This concludes the Curses::Widgets demonstration.  Please send all comments, suggestions, criticisms, and bug reports to corliss@digitalmages.com.

Press any key to exit.
__EOF__
scankey($mwh);

exit 0;

END {
  # The END block just ensures that Curses always cleans up behind
  # itself



( run in 2.789 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )