Catch a windows exit?
Catch a windows exit?
When I close the window of 'tower of hanoi' demo, I get a error 'invalid command name ".hw.can" '. Is their a way to catch the closing message properly and make a clean exit?
Hans-Peter
This should only occur, if you close the window before Hanoi has finished (it's a timing situation, expensive to code around). If it occurs after Hanoi finished then it's a bug, but I can't reproduce it.
Also, I replaced v.7.0.1 at 11:36pm 2002-10-24 Pacific Standard Time and I think you (?) downloaded 7.0.1 just before it. I replaced 7.0.1 because of a last minute newlisp_manual.html change for latest pop3.lsp.
Lutz
Also, I replaced v.7.0.1 at 11:36pm 2002-10-24 Pacific Standard Time and I think you (?) downloaded 7.0.1 just before it. I replaced 7.0.1 because of a last minute newlisp_manual.html change for latest pop3.lsp.
Lutz
newLISP is pushing graphics operations to the Tcl/Tk frontend. The Tcp/Ip listener port in the Tcl/Tk frontend is event driven. It receives Tcl/Tk commands and executes them. Now you are closing the window and the graphics command draws in an nonexisting window, which is called .hw.can (the hanoi window canvas). In TK widgets are treated like commands, which can execute stuff on themselves, kind of an OO approach.
One could code around it, checking the existence of .hw.can before each drawing command with "winfo exists .hw.can" which returns 1 or 0 depending on existence. You would do this in the "(make-disk ...)" function:
(if (= (tk "winfo exists .hw.can") "1")
(tk ".hw.can create rectangle " x " " y " " x1 " " y1 " -fill red -tag " "disk" disk))
Lutz
One could code around it, checking the existence of .hw.can before each drawing command with "winfo exists .hw.can" which returns 1 or 0 depending on existence. You would do this in the "(make-disk ...)" function:
(if (= (tk "winfo exists .hw.can") "1")
(tk ".hw.can create rectangle " x " " y " " x1 " " y1 " -fill red -tag " "disk" disk))
Lutz