From: Zbigniew D. <z....@gm...> - 2010-07-28 10:50:22
|
Could someone test the following mini-program? I used the DVD-delivered Tcltk 8.5.7 and a version 8.5.8 compiled for macos from the official Sourceforge sources. The program is crashing with Snow Leopard 10.6.2, i.e. hanging in an infinite loop. If I set as shortcut just a character then the toplevel dialog is opening and answering like it should. Curiously *both* meta keys can be called to open the dialog window. Which should be the proper shortcut for a command key? Following the advice in the link: http://www.tkdocs.com/tutorial/menus.html#menubars > Accelerator Keys > ...Example of valid > accelerator options are "Command-N", "Shift+Ctrl+X", and > "Command-Option-B". Commonly used modifiers include "Control", > "Ctrl", "Option", "Opt", "Alt", "Shift", "Command", "Cmd" and > "Meta"). > > On Mac OS X, those modifiers will be automatically mapped to the > different modifier icons that appear in menus. I tried "Cmd-e" and it showed the Apple key with "e" Thanks in advance --- Code begins --- package require Tk 8.5 proc toplevelDialog {} { toplevel .dialog wm protocol .dialog WM_DELETE_WINDOW exit set ::mutex 0 vwait ::mutex destroy .dialog } set meta Control set menu_meta Ctrl if {[tk windowingsystem] == "aqua"} { set meta Command set menu_meta Cmd ;# this crashes # set menu_meta "" ;# this is my workaround } menu .mbar . configure -menu .mbar .mbar add cascade -label Test -menu .mbar.test menu .mbar.test -tearoff 0 .mbar.test add command \ -label Toplevel \ -command toplevelDialog \ -accelerator "$menu_meta-E" .mbar.test add command \ -label "Set mutex 1" \ -command {set ::mutex 1} \ -accelerator "$menu_meta-S" .mbar.test add command \ -label "Quit" \ -command {exit} \ -accelerator "$menu_meta-X" bind . <$meta-e> {.mbar.test invoke 0} bind . <$meta-s> {.mbar.test invoke 1} bind . <$meta-x> {.mbar.test invoke 2} --- Code end --- |