sub GUI_PopupQuery { my ($title, $AffirmativeText, $NegativeText, $str) = @_; print("\a"); ## beep my ($topLevel, $topFrame, $botFrame, $labelFrame, $CancelButton, $OKButton); $topLevel = $MW->Toplevel(); $topLevel->wm('transient', $MW); $topLevel->geometry('+200+200'); $topLevel->title("$title"); $topLevel->resizable(1, 0); ## FRAMES... $topFrame = $topLevel->Frame(-height => 120, -width => 150, -relief => 'ridge', )->pack(-side => 'top', -fill => 'both', -expand => 1); $botFrame = $topLevel->Frame(-height => 120, -width => 150, -relief => 'ridge', -borderwidth => 2, )->pack(-side => 'bottom', -fill => 'both', -expand => 1); ## TOP FRAME ELEMENTS... $topFrame->Frame( -height => 20, )->pack(-side => 'top', -pady => 5, -fill => 'both', -expand => 1); $labelFrame = $topFrame->Frame(-height => 50, -width => 50, -relief => 'flat', -borderwidth => 2, )->pack(-side => 'top', -fill => 'both', -expand => 1, -pady => 5); $labelFrame->Label(-text => $str, -width => 60, -relief => 'groove', -padx => 6, -pady => 6, -bg => 'red3', -fg => 'white', )->pack( -anchor => 'center', -fill => 'both', -expand => 1); ## BOTTOM FRAME ELEMENTS... my $botButtonFrame = $botFrame->Frame(-height => 120, -width => 150, -relief => 'ridge', -borderwidth => 2, )->pack(-side => 'bottom'); $OKButton = $botButtonFrame->Button(-text => $AffirmativeText, -padx => 8, -pady => 8, -width => 8, -command => sub { $returnval=1; $topLevel->grabRelease; $topLevel->destroy(); }, -font => $fontB )->pack(-side =>'left'); $CancelButton = $botButtonFrame->Button(-text => $NegativeText, -padx => 8, -pady => 8, -width => 8, -command => sub { $returnval=0; $topLevel->grabRelease; $topLevel->destroy(); }, )->pack(-side => 'left'); # Bind the "OK" button to exit when "" # is pressed $topLevel->bind("", sub{ $topLevel->destroy(); $returnval=1; } ); $topLevel->waitVisibility(); $topLevel->waitWindow(); return $returnval; }