package ContinueBox; use Tk; use base qw(Tk::Toplevel); Tk::Widget->Construct('ContinueBox'); sub Populate { my ($cw, $args) = @_; $cw->SUPER::Populate($args); $cw->{Result} = ""; ## SETUP CONTROLS $cw->Label( -text => "Would you like to continue?" )->pack(-side => 'top'); my $bFrame = $cw->Frame->pack(-side => 'bottom'); $bFrame->Button( -text => "Continue", -command => sub { $cw->{Result} = "Continue"; } )->pack(-side => 'left'); $bFrame->Button( -text => "Exit", -command => sub { $cw->{Result} = "Exit"; } )->pack(-side => 'left'); $cw->protocol(WM_DELETE_WINDOW => sub { $cw->{Result} = "Exit"; }); $cw->withdraw; } sub Show { my $cw = shift; $cw->{Result} = ""; $cw->deiconify; $cw->waitVariable(\$cw->{Result}); $cw->withdraw; return $cw->{Result}; } 1;