Curses-Devkit
view release on metacpan or search on metacpan
fulldemo/cdkdemo view on Meta::CPAN
# Draw the label and wait.
$label->draw();
$label->wait();
}
##############################################################################
#
# This demostrates the Cdk viewer widget.
#
sub viewerDemo
{
# Use the file selector widget to get a filename.
my $fselect = new Cdk::Fselect ('Label' => "Filename:",
'Height' => 20,
'Width' => 50,
'Dattrib' => "</16/B>",
'Lattrib' => "</39>",
'Fattrib' => "</40>");
my $fname = $fselect->activate ();
# Check if the person hit escape.
if (!defined $fname)
{
return;
}
# Popup a file viewer.
my $viewer = new Cdk::Viewer ('Buttons' => ["OK"],
'Height' => 0,
'Width' => -2);
# Load in the file.
my @info = qx (cat $fname); chomp (@info);
# Set the contents of the viewer.
$viewer->set ('Info' => \@info,
'Interpret' => "TRUE",
'Title' => "<R></29>Viewing filename:<!29></38>$fname<!38>");
# Activate the viewer.
$viewer->activate();
}
##############################################################################
#
# This demonstrates the Cdk entry widget.
#
sub entryDemo
{
my $continue;
my $entry = new Cdk::Entry ('Label' => "</B/56>Enter a new pause prompt: ",
'Max' => 125,
'Width' => 30);
$continue = $entry->activate ();
# Check if they hit escape.
if (! defined $continue)
{
popupLabel (["<C></U>Escape Hit",
"<C>Pause prompt not changed.", "",
"<C>$CONTINUE"]);
return;
}
# Pop up a message stating what we got.
$CONTINUE = $continue;
my @mesg = ("<C>The new pause prompt is now set to",
"<C>what is below this message",
"<C>$CONTINUE");
labelDemo (@mesg);
}
##############################################################################
#
# This demonstrates the Cdk itemlist widget.
#
sub itemlistDemo
{
# Declare locals.
my $row;
# Create the list.
my @months = ("<C>January", "<C>Feburary", "<C>March", "<C>April",
"<C>May", "<C>June", "<C></2>July<!2>", "<C>August",
"<C>September", "<C></32>October<!32>", "<C>November",
"<C></18>December<!18>");
# Get the current date info.
my $info = qx (date +"%d,%m,%Y"); chomp $info;
my ($currentDay, $currentMonth, $currentYear) = split (/,/, $info);
$currentMonth--;
# Create n itemlist to get the month.
my $monthList = new Cdk::Itemlist ('Label' => '</B/5>Pick a month ',
'Default' => $currentMonth,
'List' => \@months);
# Get the month name.
my $choice = $monthList->activate();
undef $monthList;
# Did they hit escape?
return if ! defined $choice;
$choice++;
# Create a scale to get the year.
my $yearScale = new Cdk::Scale ('Label' => '</B/5>Pick a year',
'Width' => 6,
'Low' => "1900",
'High' => "2200");
# Set the limits of the years to select from.
$yearScale->set ('Low' => 1900,
'High' => '2200',
'Value' => "$currentYear");
# Get the year.
my $year = $yearScale->activate();
undef $yearScale;
( run in 1.483 second using v1.01-cache-2.11-cpan-364913b4093 )