Curses-Devkit
view release on metacpan or search on metacpan
fulldemo/cdkdemo view on Meta::CPAN
# Create the scrolling list ...
my $helplist = new Cdk::Scroll ('Title' => "<C></U/B/29>Pick A Topic",
'Highlight' => "</R>",
'List' => \@conceptList,
'Numbers' => "TRUE",
'Height' => $#conceptList+4,
'Width' => 40);
# Keep doing this until we are told to leave.
for (;;)
{
# Redraw the screen.
Cdk::refreshCdkScreen();
# Get the choice from the user.
my $choice = $helplist->activate();
# Exit if we have to .
return if ! defined $choice;
return if $choice == $#conceptList;
# Create the help filename
$helpfile = "${helpdir}/$helpFiles[$choice]";
$topic = "$conceptList[$choice]";
# Check if the file exists.
if (! -e $helpfile)
{
my @error = (
"<C></16>Can not seem to find the help file on the topic </U>$topic<!U><!16>",
"<C></16>Try setting the CDKHELPDIR environment variable<!16>",
"<C></16>or check if the help file '$helpfile' exists<!16>", "",
"<C>$CONTINUE");
labelDemo (@error);
}
else
{
# Display the file.
my @info = ();
undef $helpviewer;
my $helpviewer = new Cdk::Viewer ('Buttons' => ["OK"],
'Height' => $rows-3,
'Width' => $cols-2);
chop (@info = `cat $helpfile`);
$helpviewer->set ('Title' => "<C></18>Help: </U>$topic<!18U>",
'Info' => \@info);
$helpviewer->activate();
}
}
}
sub widgetHelp
{
my ($helpfile, $topic, $helpviewer);
my $helpdir = $ENV{'CDKHELPDIR'} || "./help";
# Define the widget help files.
my @helpFiles = ("alphalist.help",
"calendar.help",
"dialog.help",
"entry.help",
"fselect.help",
"graph.help",
"histogram.help",
"itemlist.help",
"label.help",
"marquee.help",
"matrix.help",
"menu.help",
"mentry.help",
"radio.help",
"scale.help",
"scroll.help",
"swindow.help",
"selection.help",
"slider.help",
"template.help",
"viewer.help");
# Define the widget help entries.
my @widgetList = ("</B/40>Alphalist Widget <!40>",
"</B/40>Calendar Widget <!40>",
"</B/40>Dialog Widget <!40>",
"</B/40>Entry Field Widget <!40>",
"</B/40>File Selector Widget <!40>",
"</B/40>Graph Widget <!40>",
"</B/40>Histogram Widget <!40>",
"</B/40>Item List Widget <!40>",
"</B/40>Label Widget <!40>",
"</B/40>Marquee Widget <!40>",
"</B/40>Matrix Widget <!40>",
"</B/40>Menu Widget <!40>",
"</B/40>Multiple Line Entry Widget <!40>",
"</B/40>Radio List Widget <!40>",
"</B/40>Scale Widget <!40>",
"</B/40>Scrolling List Widget <!40>",
"</B/40>Scrolling Window Widget <!40>",
"</B/40>Selection List Widget <!40>",
"</B/40>Slider Widget <!40>",
"</B/40>Template Widget <!40>",
"</B/40>Viewer Widget <!40>",
"</B/40>Exit Help <!40>");
# Get the screen dimensions.
my ($rows, $cols) = Cdk::getCdkScreenDim();
# Create the scrolling list ...
my $helplist = new Cdk::Scroll ('Title' => "<C></U/B/29>Pick A Topic",
'Highlight' => "</R>",
'List' => \@widgetList,
'Numbers' => "TRUE",
'Height' => $#widgetList+4,
'Width' => 40);
# Keep doing this until we are told to leave.
for (;;)
{
# Redraw the screen.
Cdk::refreshCdkScreen();
( run in 0.859 second using v1.01-cache-2.11-cpan-d8267643d1d )