Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | |
2 | ||
3 | sub mkListbox3 { | |
4 | ||
5 | # Create a top-level window containing a listbox with a bunch of well-known sayings. The listbox can be scrolled or | |
6 | # scanned in two dimensions. | |
7 | ||
8 | $mkListbox3->destroy if Exists($mkListbox3); | |
9 | $mkListbox3 = $top->Toplevel(); | |
10 | my $w = $mkListbox3; | |
11 | dpos $w; | |
12 | $w->title('Listbox Demonstration (well-known sayings)'); | |
13 | $w->iconname('Listbox'); | |
14 | $w->minsize('1', '1'); | |
15 | my $w_msg = $w->Label(-font => '-Adobe-times-medium-r-normal--*-180-*-*-*-*-*-*', -wraplength => '3.5i', | |
16 | -justify => 'left', -text => 'The listbox below contains a collection of well-known sayings. You ' . | |
17 | 'can scan the list using either of the scrollbars or by dragging in the listbox window with ' . | |
18 | 'button 2 pressed. Click the "OK" button when you\'re done.'); | |
19 | my $w_frame = $w->Frame(-borderwidth => 10); | |
20 | my $w_ok = $w->Button(-text => 'OK', -width => 8, -command => ['destroy', $w]); | |
21 | $w_msg->pack(-side => 'top'); | |
22 | $w_ok->pack(-side => 'bottom'); | |
23 | $w_frame->pack(-side => 'top', -expand => 'yes', -fill => 'y'); | |
24 | ||
25 | my $w_frame_yscroll = $w_frame->Scrollbar(); | |
26 | my $w_frame_xscroll = $w_frame->Scrollbar(-orient => 'horizontal'); | |
27 | my $w_frame_list = $w_frame->Listbox(-width => 20, -height => 10, -yscrollcommand => ['set', $w_frame_yscroll], | |
28 | -xscrollcommand => ['set', $w_frame_xscroll], -setgrid => '1'); | |
29 | $w_frame_yscroll->configure(-command => ['yview', $w_frame_list]); | |
30 | $w_frame_xscroll->configure(-command => ['xview', $w_frame_list]); | |
31 | $w_frame_yscroll->pack(-side => 'right', -fill => 'y'); | |
32 | $w_frame_xscroll->pack(-side => 'bottom', -fill => 'x'); | |
33 | $w_frame_list->pack(-expand => 'yes', -fill => 'y'); | |
34 | ||
35 | $w_frame_list->insert(0, 'Waste not, want not', 'Early to bed and early to rise makes a man healthy, wealthy, and wise', | |
36 | 'Ask not what your country can do for you, ask what you can do for your country', 'I shall return', | |
37 | 'NOT', 'A picture is worth a thousand words', 'User interfaces are hard to build', | |
38 | 'Thou shalt not steal', 'A penny for your thoughts', | |
39 | 'Fool me once, shame on you; fool me twice, shame on me', 'Every cloud has a silver lining', | |
40 | 'Where there\'s smoke there\'s fire', 'It takes one to know one', 'Curiosity killed the cat', | |
41 | 'Take this job and shove it', 'Up a creek without a paddle', | |
42 | 'I\'m mad as hell and I\'m not going to take it any more', 'An apple a day keeps the doctor away', | |
43 | 'Don\'t look a gift horse in the mouth'); | |
44 | ||
45 | } # end mkListbox3 | |
46 | ||
47 | ||
48 | 1; |