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

While working with some dialog boxes in PerlTk I noticed that the standard upper-right hand "X" doesnt close the Dialog Box like it should. Is there any way to fix that? (Btw, Im on Windows XP using ActiveState v5.6)

Thanks
  • Comment on Windows Exit from Dialog Box in Perl/Tk

Replies are listed 'Best First'.
Re: Windows Exit from Dialog Box in Perl/Tk
by arden (Curate) on Jun 04, 2004 at 14:19 UTC
    I've worked with Perl/Tk using ActiveState 5.6 and 5.8 and have had no problems using the "X" to close windows. If you want to capture that, it's the "destroy" event, so for a mainWindow $mw, use  $mw->OnDestroy( \&this_sub );

    Maybe you're code is expecting something to be returned and when it's not it prevents the destroy call. It would really help us to help you if you posted some of the relevant code. . .

    - - arden.

      Hmm.. I know how to destroy a window with a button and all but yeah I can't close it with that "X". Heres some of the relevant code which is really just a dialog box..
      my $dialog_comingsoon = $main_window->DialogBox( -title => "COMING SOON"); $dialog_comingsoon->Label(-text=>'Patience.')->pack; $dialog_comingsoon->Label(-text=>'This feature will be act + ive in the next release.')->pack; $dialog_comingsoon->Label(-text=>'Thank You.')->pack;
      Heres also an example picture of the dialog box:

      http://www.angelfire.com/linux/penguinfood/dialogbox.jpg
Re: Windows Exit from Dialog Box in Perl/Tk
by eserte (Deacon) on Jun 04, 2004 at 15:41 UTC
    Are you using messageBox, getOpenFile, getSaveFile, or a custom dialog with Tk::DialogBox or Tk::Dialog?
      I'm using Tk::DialogBox
        I think I have somewhere a patch which introduces the ability to close a dialog with <Escape> or the system close button if there's only one dialog button, or if a -cancel_button or -close_button was specified.