File: screen-menu.pl

package info (click to toggle)
libui-dialog-perl 1.21-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 808 kB
  • sloc: perl: 7,403; makefile: 2
file content (52 lines) | stat: -rw-r--r-- 875 bytes parent folder | download | duplicates (3)
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
50
51
52
#!/usr/bin/env perl
use strict;
use warnings;
use diagnostics;
use constant { TRUE => 1, FALSE => 0 };

use lib qw(./lib);
use UI::Dialog::Screen::Menu;

#
#: Demonstrate usage of UI::Dialog::Screen::Menu
#


our $counter = 0;

my $s = new UI::Dialog::Screen::Menu
 (
  title => "test title",
  text => "test text",
  order => [ 'dialog' ]
 );
$s->add_menu_item
 ( "An Action ".$counter,
   sub {
       my ($self,$dialog,$index) = @_;
       $counter++;
       $s->set_menu_item( $index, "An Action ".$counter, undef );
   }
 );

my $s2 = new UI::Dialog::Screen::Menu
 (
  title => "test 2 title",
  text => "test 2 text",
  order => [ 'dialog' ]
 );
$s2->add_menu_item
 ( "Another Option",
   sub {
       my ($self,$dialog,$index) = @_;
       $dialog->msgbox( text => "Hi" );
   }
 );
$s->add_menu_item
 ( "Next Screen",
   sub { $s2->loop(); }
 );

$s->loop();

exit 0;