File: selection

package info (click to toggle)
libcdk-perl 20240606-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,732 kB
  • sloc: perl: 6,146; sh: 3,599; makefile: 28
file content (49 lines) | stat: -rwxr-xr-x 971 bytes parent folder | download | duplicates (2)
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
49
#!/usr/bin/perl -w
# $Id: selection,v 1.4 2019/02/17 20:30:55 tom Exp $

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

use strict;

#
# Initialize Cdk.
#
use Cdk;
Cdk::init();

# Set up the selection list.
my @listItems = (
    "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6",
    "Item 7", "Item 8", "Item 9"
);

my @choices = ( "Yes", "No", "Maybe" );

# Create the selection list object.
my $selection = new Cdk::Selection(
    'Title'   => "</5>Selection List",
    'List'    => \@listItems,
    'Choices' => \@choices,
    'Height'  => 10,
    'Width'   => 20
);

# Activate the object.
my @info = $selection->activate();

# Check the results.
if ( !@info ) {
    popupLabel( ["<C>Escape hit. No menu item selected."] );
}
else {
    my @list = ("<C></R>Items Selected");
    for ( my $x = 0 ; $x < $#info ; $x++ ) {
        push( @list, "<C>$listItems[$x]" ) if $info[$x] == 0;
    }
    popupLabel( \@list );
}

# Exit Cdk.
Cdk::end();