[ROOT] TButton push eats macro variables

From: David Faden (dfaden@iastate.edu)
Date: Sat Jun 09 2001 - 00:48:14 MEST


Hi,
   A click on a TButton drawn in compiled code seems to be erasing the 
definitions of variables in the interpreted code that is calling the 
compiled code. The TButton executes a command inspired by dialogs.C:

 Char_t command[256];
  sprintf(command,
	  "{TH1 *h__ptr = (TH1*)0x%x; h__ptr->GetXaxis()->UnZoom(); 
h__ptr->GetYaxis()->UnZoom(); ((TPad*)0x%x)->Modified();}", histo, 
displayPad);
  TButton *resetButton = new TButton("Reset view", 
				     command, 0.025, 0.025, 0.5, 0.15);

   A macro calls a method of our compiled class, which brings up a 
TCanvas with a TButton in it. If the TButton is clicked and its method 
executed, ROOT bombs out of the macro complaining of "No symbol xxxx in 
current scope", where xxxx is the name of a variable defined in the macro.
   I haven't been able to reproduce this problem in simpler, purely 
interpreted code.
   If a macro calls compiled code, which in turn executes some 
interpreted code (via gROOT->ProcessLine() as TButton seems to), will 
all variable declarations in the original macro be lost?
   I have a couple of workarounds (probably more couth for compiled code 
anyway), but I'm curious what's going on.
   This code was run under ROOT 3.01/02 14 May 2001 under Red Hat Linux 
6.1 on an i386.
   Thank you.

David 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:49 MET