Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | |
2 | ||
3 | sub mkIcon { | |
4 | ||
5 | # Create a top-level window that displays a bunch of iconic buttons. | |
6 | ||
7 | $mkIcon->destroy if Exists($mkIcon); | |
8 | $mkIcon = $top->Toplevel(); | |
9 | my $w = $mkIcon; | |
10 | dpos $w; | |
11 | $w->title('Iconic Button Demonstration'); | |
12 | $w->iconname('Icons'); | |
13 | $w->Bitmap('flagup', -file => Tk->findINC('demos/images/flagup'), | |
14 | -maskfile => Tk->findINC('demos/images/flagup')); | |
15 | $w->Bitmap('flagdown', -file => Tk->findINC('demos/images/flagdown'), | |
16 | -maskfile => Tk->findINC('demos/images/flagdown')); | |
17 | my $w_msg = $w->Label(-font => '-Adobe-times-medium-r-normal--*-180-*-*-*-*-*-*', -wraplength => '4.5i', | |
18 | -justify => 'left', -text => 'This window shows three ways of using bitmaps or images in ' . | |
19 | 'radiobuttons and checkbuttons. On the left are two radiobuttons, each of which displays a ' . | |
20 | 'bitmap and an indicator. In the middle is a checkbutton that displays a different image ' . | |
21 | 'depending on whether it is selected or not. On the right is a checkbutton that displays a ' . | |
22 | 'single bitmap but changes its background color to indicate whether or not it is selected. ' . | |
23 | 'Click the "OK" button when you\'re done.'); | |
24 | my $w_frame = $w->Frame(-borderwidth => '10'); | |
25 | my $w_ok = $w->Button(-text => 'OK', -command => ['destroy', $w], -width => '8'); | |
26 | my @pl = (-side => 'top'); | |
27 | $w_msg->pack(@pl); | |
28 | $w_frame->pack(@pl); | |
29 | $w_ok->pack(@pl); | |
30 | ||
31 | my $w_frame_b1 = $w_frame->Checkbutton(-image => 'flagdown', -selectimage => 'flagup', -indicatoron => 0, | |
32 | -selectcolor => 'bisque1', -activebackground => 'bisque1'); | |
33 | my $w_frame_b2 = $w_frame->Checkbutton(-bitmap => '@'.Tk->findINC('demos/images/letters'), -indicatoron => 0, | |
34 | -selectcolor => '#efbd9b'); | |
35 | my $w_frame_left = $w_frame->Frame(); | |
36 | @pl = (-side => 'left', -expand => 'yes', -padx => '5m'); | |
37 | $w_frame_left->pack(@pl); | |
38 | $w_frame_b1->pack(@pl); | |
39 | $w_frame_b2->pack(@pl); | |
40 | ||
41 | $letters = ''; | |
42 | my $w_frame_left_b3 = $w_frame_left->Radiobutton(-bitmap => '@'.Tk->findINC('demos/images/letters'), -variable => \$letters, | |
43 | -value => 'full'); | |
44 | my $w_frame_left_b4 = $w_frame_left->Radiobutton(-bitmap => '@'.Tk->findINC('demos/images/noletters'), -variable => \$letters, | |
45 | -value => 'empty'); | |
46 | @pl = (-side => 'top', -expand => 'yes'); | |
47 | $w_frame_left_b3->pack(@pl); | |
48 | $w_frame_left_b4->pack(@pl); | |
49 | ||
50 | } # end mkIcon | |
51 | ||
52 | ||
53 | 1; |