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 / radio.pl
CommitLineData
86530b38
AT
1# radio.pl
2
3use vars qw/$TOP/;
4
5sub radio {
6
7 # Create a top-level window that displays a bunch of radio buttons.
8
9 my($demo) = @_;
10 $TOP = $MW->WidgetDemo(
11 -name => $demo,
12 -text => ['Two groups of radiobuttons are displayed below. If you click on a button then the button will become selected exclusively among all the buttons in its group. A Perl variable is associated with each group to indicate which of the group\'s buttons is selected. Click the "See Variables" button to see the current values of the variables.', qw/-wraplength 5i/],
13 -title => 'Radiobutton Demonstration',
14 -iconname => 'radio',
15 );
16
17 my $var = $TOP->Button(
18 -text => 'See Variables',
19 -command => [\&see_vars, $TOP, [
20 ['point size', \$POINT_SIZE],
21 ['color', \$COLOR],
22 ]
23 ],
24 );
25 $var->pack(qw/-side bottom -expand 1/);
26
27 my @pl = qw/-side left -expand 1 -padx .5c -pady .5c/;
28 my $left = $TOP->Frame->pack(@pl);
29 my $right = $TOP->Frame->pack(@pl);
30
31 @pl = qw/-side top -pady 2 -anchor w/;
32 foreach my $p (10, 12, 18, 24) {
33 $left->Radiobutton(
34 -text => "Point Size $p",
35 -variable => \$POINT_SIZE,
36 -relief => 'flat',
37 -value => $p,
38 )->pack(@pl);
39 }
40
41 foreach my $c (qw/Red Green Blue Yellow Orange Purple/) {
42 $right->Radiobutton(
43 -text => $c,
44 -variable => \$COLOR,
45 -relief => 'flat',
46 -value => lc($c),
47 )->pack(@pl);
48 }
49
50} # end radio
51
521;