PERL BEGINNERS 20 CLOSING WINDOW IN PERL TK
Subject: Closing window in Perl/Tk
Date: Fri, 08 Aug 2003 11:07:53 +0530

From: sachin_hegde@no-spam (Sachin Hegde)

Hi all,
I am writing an UI application inPerl/Tk. I have some functions which I am supposed to run before the application closes. How do I calll this function, say Funct(), when the user clicks on the close icon of the window?
Sachin
_________________________________________________________________
Want to visit Spain? Click here. http://server1.msn.co.in/sp03/spain/index.asp Win a free trip.


Subject: Re: Closing window in Perl/Tk
Date: Fri, 08 Aug 2003 10:26:01 -0400













From: zentara@no-spam (Zentara)
On Fri, 08 Aug 2003 11:07:53 +0530, sachin_hegde@no-spam (Sachin Hegde) wrote:

>Hi all,
>I am writing an UI application inPerl/Tk. I have some functions which I am >supposed to run before the application closes. How do I calll this function, >say Funct(), when the user clicks on the close icon of the window?
>Sachin
Something like this:
#!/usr/bin/perl use warnings;
use strict;
use Tk;

my $mw = new MainWindow;
$mw->title("Close test");
$mw->geometry("400x250");

#prevents mw from closing $mw->protocol('WM_DELETE_WINDOW' => sub { Funct(); exit;} );

MainLoop;