Capturing Command-Q in Darwin tclkits
irrational <[email protected]> Mon, 20 Apr 2009 00:28:01 -0700 (PDT)
| Newsgroups | gmane.comp.lang.tcl.starkit |
|---|---|
| Message-ID | <[email protected]> |
I have an application that wants to do some cleaning-up and query user
about unsaved changes before quitting.
Here is a little test.tcl for doing this
--------------------------
# test.tcl
package require Tk
proc my_exit {} {
puts {Drive safely}
exit
}
button .q -text Quit -command my_exit
pack .q
bind . <Control-q> my_exit
bind . <Command-q> my_exit
--------------------------
You see my safe exit procedure should run on clicking the Quit button,
or typing Control-Q, or Command-Q.
On a Mac, running
wish test.tcl
all quit routes behave as intended. Using tclkits, the button and
Control-Q work as expected. However, running
tclkit-darwin-univ-aqua test.tcl
a Command-Q exits the tclkit without going through my_exit, and
running
tclkit-darwin-univ test.tcl
a Command-Q brings up a dialog as to whether I want to exit X11.
Why does this happen, and how do I get the behaviour I want?
(Actually I'd be happy with a "how" answer without the "why")
K