[GRASS5] pre2 nviz & darwin -- part ii

Glynn Clements glynn.clements at virgin.net
Sat Oct 27 13:00:57 EDT 2001

andy agena wrote:

> nviz -q (with or without tcltkgrass running) very briefly flashes the 
> "wait_ok" and nviz boxes, then gives the '"wait_ok" already exists in 
> parent' error in the xterm.  the nviz i/o box doesn't appear.
> using the tcltkgrass menu for nviz pops up three windows (wait_ok, nviz 
> i/o, and  nviz), nviz i/o says:  'loading data,' 'update elev null 
> mask,' 'loading data,' 'translating colors,' then ends with 'sorry, 
> <el=> is ambiguous' (this "el=" is passed from the command line box in 
> the nviz dialog and i can't edit it).

I've found something which looks relevant.

In NVIZ_AppInit (nvizAppInit.c), Ninit() may be called twice. First:

	  if (Tk_Init(interp) == TCL_ERROR) {
	/* Handle TCL/TK errors by passing to the G_parser
	** Calls Ninit to spit out NVIZ usage message 
	** instead of TCL usage message
		Ninit(interp, mainWindow);	
	return TCL_ERROR;

then later:

	  Ninit(interp, mainWindow);
	  return TCL_OK;

Ninit() calls Ninitdata(), which calls parse_command(), which:

1. Creates all of the options with G_define_option() then calls
G_parser(), hence the "ambigous" error (the second run will define all
of the options again, so the "el=..." argument will match both of the
"elevation" options).

2. Creates the .wait_ok window with:

	    if (Tcl_Eval(interp, startup_script) != TCL_OK) {

where startup_script is:

	char startup_script[] =
	"toplevel .wait_ok\n\
	label .wait_ok.wait -text \"Please wait...\" -fg red -bg black\n\
	pack .wait_ok.wait -ipadx 20 -ipady 20 -expand 1 -fill both\n\
	wm geometry .wait_ok \"+800+50\"\n\
	wm geometry . \"+100+100\"\n\
	grab .wait_ok.wait";

In short, the symptoms which you describe are exactly what I would
expect to happen if Ninit() was called twice.

Try changing the first block of code above to e.g.:

	  if (Tk_Init(interp) == TCL_ERROR) {
		fprintf(stderr, "Tk_Init failed\n");
		return TCL_ERROR;

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list