Re: Odd error when closing a window.



"Dave (from the UK)" <see-my-signature@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:

below. Closing the Window works fine, but if I hit the download button first,
then try to hit Cancel, it generates an error.

proc ::tools::twic {} {
... blah blah blah ... nothing relevant

proc ::tools::twic::download {} {
# There are no buttons in this procedure.
}

Ha ha, hiding anything that is relevant to the problem.

But if I
1) Hit the 'dwonload' button then
2) Hit the cancel button,

I get this:

invalid command name ".twicWin.tf.txt"
invalid command name ".twicWin.tf.txt"
while executing
".twicWin.tf.txt insert end "$ZIPFILE ( $ZIPFILESIZE b )\n""

Of course the good proc to show is what contains this command.

I presume it is the download proc that keeps chugging along,
even while you click the cancel button.

You need to put a test in there, allowing the cancel button to
actually cancel the procedure. You could have some global variable \
as a flag, but it makes sense to just look for the gui widgets,
like

if { ![winfo exists .twicWin.tf.txt] } {
# cancelled or closed. Abort what we were doing and disappear.
}


--
Donald Arseneau asnd@xxxxxxxxx
.