summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl.straw/lib/Tk/demos/widget_lib/check.pl
blob: a5f9a10c09356e1944c74ec74e37888aca389beb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# check.pl

use vars qw/$TOP/;

sub check {

    # Create a top-level window that displays a bunch of check buttons.

    my($demo) = @_;
    $TOP = $MW->WidgetDemo(
        -name     => $demo,
        -text     => 'Three checkbuttons are displayed below.  If you click on a button, it will toggle the button\'s selection state and set a Perl variable to a value indicating the state of the checkbutton.  Click the "See Variables" button to see the current values of the variables.',
        -title    => 'Checkbutton Demonstration',
        -iconname => 'check',
    );

    my $var = $TOP->Button(
        -text    => 'See Variables',
        -command => [\&see_vars, $TOP, [
					['wipers', \$WIPERS],
					['brakes', \$BRAKES],
					['sober',  \$SOBER],
					],
		     ],
    );
    $var->pack(qw/-side bottom -expand 1/);

    my(@pl) = qw/-side top -pady 2 -anchor w/;
    my $b1 = $TOP->Checkbutton(
        -text     => 'Wipers OK',
        -variable => \$WIPERS,
	-relief   => 'flat')->pack(@pl);
    my $b2 = $TOP->Checkbutton(
        -text     => 'Brakes OK',
        -variable => \$BRAKES,
	-relief   => 'flat')->pack(@pl);
    my $b3 = $TOP->Checkbutton(
        -text     => 'Driver Sober',
        -variable => \$SOBER,
	-relief   => 'flat')->pack(@pl);

} # end check

1;