| 1 | # dialog2.pl |
| 2 | |
| 3 | use subs qw/see_code/; |
| 4 | use vars qw/$DIALOG2/; |
| 5 | |
| 6 | sub dialog2 { |
| 7 | |
| 8 | my($demo) = @_; |
| 9 | |
| 10 | my($ok, $can, $see) = ('OK', 'Cancel', 'See Code'); |
| 11 | if (not Exists($DIALOG2)) { |
| 12 | $DIALOG2 = $MW->Dialog( |
| 13 | -title => 'Dialog with global grab', |
| 14 | -text => '', |
| 15 | -bitmap => 'info', |
| 16 | -default_button => $ok, |
| 17 | -buttons => [$ok, $can, $see], |
| 18 | ); |
| 19 | $DIALOG2->configure( |
| 20 | -wraplength => '4i', |
| 21 | -text => 'This dialog box uses a global grab, so it prevents you from interacting with anything on your display until you invoke one of the buttons below. Global grabs are almost always a bad idea; don\'t use them unless you\'re truly desperate.', |
| 22 | ); |
| 23 | } |
| 24 | |
| 25 | my $button = $DIALOG2->Show('-global'); |
| 26 | |
| 27 | print "You pressed OK\n" if $button eq $ok; |
| 28 | print "You pressed Cancel\n" if $button eq $can; |
| 29 | see_code 'dialog2' if $button eq $see; |
| 30 | |
| 31 | } # end dialog2 |
| 32 | |
| 33 | 1; |