Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / site_perl / 5.8.0 / sun4-solaris / Tk / demos / widget_lib / mkButton.pl
CommitLineData
86530b38
AT
1
2
3sub mkButton {
4
5 # Create a top-level window that displays a bunch of buttons.
6
7 $mkButton->destroy if Exists($mkButton);
8 $mkButton = $top->Toplevel();
9 my $w = $mkButton;
10 dpos $w;
11 $w->title('Button Demonstration');
12 $w->iconname('Buttons');
13
14 my $w_msg = $w->Message(-font => '-Adobe-times-medium-r-normal--*-180-*-*-*-*-*-*', -aspect => 300,
15 -text => 'If you click on any of the top four buttons below, the background of the button ' .
16 'area will change to the color indicated in the button. Click the "OK" button when you\'ve ' .
17 'seen enough.');
18 $w_msg->pack(-side => 'top', -fill => 'both');
19
20 my($w_b1, $w_b2, $w_b3, $w_b4, $w_ok);
21 $w_b1 = $w->Button(-text => 'Peach Puff', -width => 10, -command => [sub {shift->configure(-bg => 'PeachPuff1')}, $w]);
22 $w_b2 = $w->Button(-text => 'Light Blue', -width => 10, -command => [sub {shift->configure(-bg => 'LightBlue1')}, $w]);
23 $w_b3 = $w->Button(-text => 'Sea Green', -width => 10, -command => [sub {shift->configure(-bg => 'SeaGreen2')}, $w]);
24 $w_b4 = $w->Button(-text => 'Yellow', -width => 10, -command => [sub {shift->configure(-bg => 'Yellow1')}, $w]);
25 $w_ok = $w->Button(-text => 'OK', -width => 10, -command => ['destroy', $w]);
26 my(@pl) = (-side => 'top', -expand => 'yes', -pady => 2);
27 $w_b1->pack(@pl);
28 $w_b2->pack(@pl);
29 $w_b3->pack(@pl);
30 $w_b4->pack(@pl);
31 $w_ok->pack(@pl);
32
33} # end mkButton
34
35
361;