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 / button.pl
CommitLineData
86530b38
AT
1# button.pl
2
3use vars qw/$TOP/;
4
5sub button {
6
7 # Create a top-level window that displays a bunch of buttons.
8
9 my($demo) = @_;
10 $TOP = $MW->WidgetDemo(
11 -name => $demo,
12 -text => 'If you click on any of the four buttons below, the background of the button area will change to the color indicated in the button. You can press Tab to move among the buttons, then press Space to invoke the current button.',
13 -title => 'Button Demonstration',
14 -iconname => 'button',
15 );
16
17 foreach my $color (qw/PeachPuff1 LightBlue1 SeaGreen2 Yellow1/) {
18 my $b = $TOP->Button(
19 -text => $color,
20 -width => 10,
21 -command => sub {$TOP->configure(-background => lc($color))},
22 );
23 $b->pack(qw/-side top -expand yes -pady 2/);
24 }
25
26} # end button
27
281;