|< 1 2 >| | 11 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#! /usr/bin/perl
use strict;
use warnings;
use Tk;
my $mw = MainWindow->new();
my $frame = $mw->Frame()->pack();
my $menu = $frame->Menu(-type => 'menubar');
$menu->cascade(-label => 'test');
my $menitem = $menu->Menu(-tearoff => 0);
my $item = $menitem->command(-label => 'test2',-command => sub{print "yes";});
$menu->entryconfigure('test',-menu => $menitem);
MainLoop;
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
#! /usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::Dialog;
my $mw = MainWindow->new();
my @menues = (
[ 'cascade' => 'File',
-underline => 0,
-menuitems => [
[ 'command' => 'Exit',
-underline => 1,
-command => sub { Tk::exit() } ] ],
],
[ 'cascade' => 'Help',
-underline => 0,
-menuitems => [
[ 'command' => 'About',
-underline => 0,
-command => sub { $mw->Dialog(-title => 'About',
-text => 'Menubar Example',
-default_button => 'Ok',
-buttons => [ 'Ok' ])->Show();
} ] ],
],
);
my $menu = $mw->Menu( -menuitems => [ @menues ] );
$mw->configure( -menu => $menu );
MainLoop();
|< 1 2 >| | 11 Einträge, 2 Seiten |