Scarborough has asked for the wisdom of the Perl Monks concerning the following question:

I've searched around and looked in the O'Riley Tk book without success for how to make a Toplevel widget Model.
Is this the right term for halt the program until the OK button is pressed on the toplevel window?

Thanks for your help.

Replies are listed 'Best First'.
Re: Model toplevel widget
by amrangaye (Friar) on Dec 08, 2004 at 15:05 UTC
    Nope. The right term is modal, not model. Do another search through the O'reilly book - it's in there somewhere.
    Cheers!
Re: Model toplevel widget
by zentara (Cardinal) on Dec 09, 2004 at 11:37 UTC
    It sounds like you are looking for Tk::Dialog or Tk::DialogBox
    #!/usr/bin/perl use Tk; require Tk::DialogBox; my $main = MainWindow->new(); my $menu = $main->Menu(); $main->configure(-menu => $menu); my $save_dg = $main->DialogBox( -title => 'Save Confirmation', -buttons => ["Yes","No"], ); $save_dg->Label( -text => 'Save?', )->pack(-anchor => 'w'); $main->protocol('WM_DELETE_WINDOW', [\&gExit, $save_dg]); $main->focus; MainLoop(); sub gExit { my $save_dg = shift; #$save_dg->Show(); exit if $save_dg->Show() eq 'Yes'; }

    I'm not really a human, but I play one on earth. flash japh