home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _a896e67903a388cd4d166c7f2faed4d2 < prev    next >
Text File  |  2004-06-01  |  1KB  |  45 lines

  1. # check.pl
  2.  
  3. use vars qw/$TOP/;
  4.  
  5. sub check {
  6.  
  7.     # Create a top-level window that displays a bunch of check buttons.
  8.  
  9.     my($demo) = @_;
  10.     $TOP = $MW->WidgetDemo(
  11.         -name     => $demo,
  12.         -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.',
  13.         -title    => 'Checkbutton Demonstration',
  14.         -iconname => 'check',
  15.     );
  16.  
  17.     my $var = $TOP->Button(
  18.         -text    => 'See Variables',
  19.         -command => [\&see_vars, $TOP, [
  20.                     ['wipers', \$WIPERS],
  21.                     ['brakes', \$BRAKES],
  22.                     ['sober',  \$SOBER],
  23.                     ],
  24.              ],
  25.     );
  26.     $var->pack(qw/-side bottom -expand 1/);
  27.  
  28.     my(@pl) = qw/-side top -pady 2 -anchor w/;
  29.     my $b1 = $TOP->Checkbutton(
  30.         -text     => 'Wipers OK',
  31.         -variable => \$WIPERS,
  32.     -relief   => 'flat')->pack(@pl);
  33.     my $b2 = $TOP->Checkbutton(
  34.         -text     => 'Brakes OK',
  35.         -variable => \$BRAKES,
  36.     -relief   => 'flat')->pack(@pl);
  37.     my $b3 = $TOP->Checkbutton(
  38.         -text     => 'Driver Sober',
  39.         -variable => \$SOBER,
  40.     -relief   => 'flat')->pack(@pl);
  41.  
  42. } # end check
  43.  
  44. 1;
  45.