1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/usr/bin/perl -w
# $Id: scroll,v 1.3 2013/07/14 22:45:12 tom Exp $
#
# Purpose:
# To demonstrate the Perl5 Cdk Scroll Widget
use strict;
#
# Initialize Cdk.
#
use Cdk;
Cdk::init();
# Set up the scrolling list.
my @listItems = (
"Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6",
"Item 7", "Item 8", "Item 9"
);
# Create the scrolling list object.
my $scroll = new Cdk::Scroll(
'Title' => "<C>Scroll Title",
'Height' => -10,
'Width' => -10,
'Numbers' => "TRUE",
'Spos' => "RIGHT",
'List' => \@listItems
);
$scroll->add( 'Item' => "HELLO" );
# Activate the scrolling list.
my $itemPicked = $scroll->activate();
# Check the results.
if ( !defined $itemPicked ) {
popupLabel( ["<C>Escape hit. No menu item selected."] );
}
elsif ( $itemPicked > $#listItems ) {
popupLabel( ["<C>Hello there!"] );
}
else {
popupLabel( ["<C>You selected </R>$listItems[$itemPicked]"] );
}
# Exit Cdk.
Cdk::end();
|