From: Alastair D. <ala...@si...> - 2005-01-19 11:17:31
|
Hello again, One needs explicitly to enable the "Preferences..." menu item using the command [1]: EnableMenuCommand(NULL, kHICommandPreferences); This call can be made in TkMacOSXInitMenus() for example (in the file tkMacOSXMenus.c). If the Tcl procedure ::tk::mac::ShowPreferences is = not defined, however, having the menu item enabled is not a good thing, so = this is not a general-purpose patch. Ideally, I suppose, a Tcl variable = could be created to provide script access to enable or disable the menu item. Kind regards, Alastair Davies (P.S. I trust it's not considered bad form to answer one's own = questions: I've found the archives of this list such a useful resource that I'm responding in the hope that other users will find this helpful. :-) [1] Ref: http://developer.apple.com/qa/qa2001/qa1079.html -----Original Message----- From: Alastair Davies Sent: Thursday, January 13, 2005 11:13 AM To: tc...@li... Subject: [MACTCL] Preferences dialog and other apple event handlers Hello, I am porting an application to TkAqua, extending the embedded Wish Shell bundle with our own scripts. I am having trouble setting up the apple = event handlers in our scripts, to handle the application menu commands. (I = can add new items to the application menu, following the examples on the = Wiki and in the archives.) I would like to enable the "Preferences..." application menu command. For example, I have created the following = file "AppMain.tcl" in the "Contents/Resources/Scripts" folder of the "Wish = Shell" bundle: =3D=3Dstart AppMain.tcl=3D=3D proc ::tk::mac::ShowPreferences {} { tk_messageBox -message Preferences } button .pref -text Preferences -command ::tk::mac::ShowPreferences button .ok -text OK -command exit pack .pref -padx 125 -pady 15 pack .ok -padx 125 -pady 15 =3D=3Dend AppMain.tcl=3D=3D This doesn't seem to be enough on its own; the "Preferences..." = application menu command remains dimmed. Am I doing something wrong, or not doing something I need to do? Thank you all very much to all the contributors for the work which has enabled us to undertake this project. Kind regards, Alastair Davies (I am using MacOS X 10.2.8 and Tcl/TkAqua 8.4.9, built using the "make" files) |