Debian Codegraph @

examples/oddmenu_demo

raw
1 #!/usr/local/bin/perl -w
2 use strict;
3 use Tk;
4
5 my $mw = MainWindow->new;
6
7 my $mb = $mw->Menubutton(-text => "Strange Menu")->pack;
8
9 my $menu = $mb->menu;
10 my $lb = $menu->Scrolled('Listbox')->pack;
11 $menu->configure(-takefocus => 1);
12 $lb->insert('end',grep(-T $_,<*>));
13
14 $mw->Message(-text => qq(
15 Example of (ab)use of Menu. Creates a list box as a child of Menu and packs it.
16 Interaction is tricky. <Escape> should unpost, if menu as a whole has 'focus'.
17 ))->pack;
18
19
20 $mw->Button(-text => 'Quit', -command => [destroy => $mw])->pack;
21 MainLoop;
22