Ok, I'll try this too....

If you want to do something when the user clicks the close box
on your main toplevel window, you can do something like this:

Normally the main program has a wm statement that references
your main toplevel and causes an exit on window close. 
I add (or replace) that statement with something such as below in my
main proc.


proc {main} {argc argv} {
wm protocol .top24 WM_DELETE_WINDOW {exit}    <--- this is generated by vtcl
wm protocol .top24 WM_DELETE_WINDOW {Close}   <---- this by me replaces the above
...
}


Here is my Close proc. I am checking to see if some activity is still
ongoing (by the still_active flag) and if so, issue a warning. If the
user hits cancel, this proc then just returns and the close is effectivly
ignored (and the window stays open). 

If he hits ok, then I do the exit. If the flag is not set, then
it also simply exits. 

You could use something like this to cancel your timers. If you have some
other way of exiting also, then it is probably in code you have already written
So you would want to call your version of Close there also.


proc {Close} {} {
        global still_active
        if {$still_active} {
                set choice [tk_messageBox  -default cancel -type okcancel -message \
             "WARNING - some nodes may still be active, quit anyway?" -title {Still 
active Nodes}]
                if {$choice == "ok"} {
                        exit
                }
        } else {
                exit
        }
}






At 12:17 PM 12/19/02 -0800, you wrote:
>Send vtcl-user mailing list submissions to
>        [EMAIL PROTECTED]
>
>To subscribe or unsubscribe via the World Wide Web, visit
>        https://lists.sourceforge.net/lists/listinfo/vtcl-user
>or, via email, send a message with subject or body 'help' to
>        [EMAIL PROTECTED]
>
>You can reach the person managing the list at
>        [EMAIL PROTECTED]
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of vtcl-user digest..."
>
>
>Today's Topics:
>
>   1. canceling timers upon closing a project (Hanspeter Roth)
>
>--__--__--
>
>Message: 1
>Date: Thu, 19 Dec 2002 08:47:42 +0100
>From: Hanspeter Roth <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Reply-To: [EMAIL PROTECTED]
>Subject: [vtcl-user] canceling timers upon closing a project
>
>Hello,
>
>it seems that <<DeleteWindow>> and <Destroy> get fired on
>"_TopLevel" when closing an application which is run standalone.
>When run in Vtcl these events won't get executed when the project is
>closed.
>I have a timer which should be canceled upon termination of the
>application. After the project had been closed the timer event
>attempts to execute the command which is implemented in the
>application but is no more known.
>
>How can I determine that the project had been closed in Vtcl?
>
>-Hanspeter
>
>
>
>--__--__--
>
>_______________________________________________
>vtcl-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/vtcl-user
>
>
>End of vtcl-user Digest 



-------------------------------------------------------
This SF.NET email is sponsored by: Geek Gift Procrastinating?
Get the perfect geek gift now!  Before the Holidays pass you by.
T H I N K G E E K . C O M      http://www.thinkgeek.com/sf/
_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/vtcl-user

Reply via email to