From: Keith S. <ks...@aa...> - 2002-12-08 08:45:59
|
I wonder if anyone else has seen the following problem: I have a large Tcl/Tk program that has run under UNIX for a long time now and I have been porting it to Mac OSX. It runs very nicely under tcl/tk 8.3, using XDarwin, but I wanted to try it under 8.4 for Aqua. I built it without incident, but when I try to run it it draws all the various windows perfectly, but when I then try to click on any window all that happens is that I get an error message on the terminal: SetFrontProcess failed,-606 and all I can do is kill the process. The program implements a large number of new Tcl commands in C, and so is built as a main program that calls Tk_Main with its own initialisation program that defines these new commands. I don't think it does anything particularly unusual. It has a specific .tcl file as the file to be executed on startup and so the main program messes with the argv and argc values to insert this file name into the command line arguments, but that's about all. I have managed to reduce the code to a minimal set of three files that show the effect, in case anyone is prepared to see if they can reproduce the problem. This just tries to put up something resembling our initial dialog, but even that fails, apparently unable to bring the window to the front. I'm running on Jaguar, and downloaded the Jaguar version of TclTk for aqua 8.4.1. I've installed the standard Jaguar developer tools. Here is the main .c file, which I called ttcl.c: #include <stdlib.h> #include "tcl.h" #include "tk.h" static int AddCommands(Tcl_Interp * interp); extern int main(int argc, char *argv[]) { int i; char **newArgv; /* Modified command line arguments */ /* We have to add the Tcl script filename as the first argument. This * is required by Tk_Main. Thus, we have to malloc space for a new * argv array. */ newArgv = malloc(sizeof(char *) * (argc + 1)); newArgv[0] = argv[0]; newArgv[1] = "ttcl.tcl"; for (i = 1; i < (unsigned) argc; ++i) { newArgv[i + 1] = argv[i]; } Tk_Main(argc + 1, newArgv, AddCommands); /* * The Tk documentation says the above never returns, but just in case, * do our tidying up. */ free(newArgv); return (0); } static int AddCommands(Tcl_Interp * interp) { if (Tcl_Init(interp) == TCL_ERROR) { return TCL_ERROR; } if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit); /* Normally, I'd add a lot of C-implemented new commands here */ return TCL_OK; } and here is the Makefile I used to build this: COPT = -O CWARNINGS = -Wall CINCLUDES = -I /Library/Frameworks/Tk.framework/Headers -I /Library/Frameworks/Tcl.framework/Headers -I. CFLAGS = $(CWARNINGS) $(COPT) $(CINCLUDES) ttcl : ttcl.o $(CC) -o ttcl ttcl.o \ /Library/Frameworks/Tk.framework/Tk \ /Library/Frameworks/Tcl.framework/Tcl \ -lm ttcl.o : ttcl.c clean: rm ttcl ttcl.o and finally, here is the ttcl.tcl file that the program runs when it starts: set button [eval tk_dialog .inst_select \ \"Configure \" \ \"Please select one of the following\" \ info 1 Cancel A B C] puts "Button = $button" I'd be very grateful for any help - even if someone can confirm that they get the same problem.. Thanks, Keith Keith Shortridge Anglo-Australian Observatory P.O. Box 296 Epping, NSW 1710 Australia Tel: +61-2-9372-4822 Fax: +61-2-9372-4880 email: ks...@aa... |