File: itemlist

package info (click to toggle)
libcdk-perl 20130816-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,284 kB
  • ctags: 430
  • sloc: perl: 6,151; sh: 2,997; makefile: 24
file content (45 lines) | stat: -rwxr-xr-x 922 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl -w
# $Id: itemlist,v 1.4 2013/07/14 22:35:45 tom Exp $

#
# Purpose:
#	To demonstrate the Perl5 Cdk Itemlist Widget.

use strict;

#
# Load in the Cdk Extension.
#
use Cdk;
Cdk::init();

# Create a list of the months of the year.
my @months = (
    "<C></B>January",   "<C></B>February",
    "<C></B>March",     "<C></U>April",
    "<C></U>May",       "<C></U>June",
    "<C></K>July",      "<C></K>August",
    "<C></K>September", "<C></R>October",
    "<C></R>November",  "<C></R>December"
);

# Create an itemlist widget.
my $itemlist = new Cdk::Itemlist(
    'List'  => \@months,
    'Label' => "Month >>",
    'Title' => ["<C>Pick A Month"]
);

# Activate the object.
my $choice = $itemlist->activate();

# Check the results
if ( !defined $choice ) {
    popupLabel( ["<C>Escape hit. No item selected."] );
}
else {
    popupLabel( ["<C>You selected ($months[$choice])"] );
}

# Exit Cdk.
Cdk::end();