command line vs. macro - Mouse input

From: Martin Veselsky (veselsky@orion1.tamu.edu)
Date: Fri Oct 01 1999 - 22:47:54 MEST


Hi rooters
probably not quite advanced question. 
I am trying to write small macro where 
I want to use lines defined by mouse  
in graphic window ( canvas ). In the 
interactive session it looks like this
( with 2-dim histogram drawn in canvas ). 

root [81] gROOT->SetEditorMode("PolyLine")
root [82] TGraph *lintst = (TGraph*) gPad->GetPrimitive("Graph")
root [83] lintst->SetName("lintst")

now I extract the x,y - coordinates of points 
and can use them further. 
I made straightforward attempt to use the same 
sequence of commands in a macro:

{
gROOT->SetEditorMode("PolyLine");
TGraph *lintst = (TGraph*) gPad->GetPrimitive("Graph");
lintst->SetName("lintst");
lintst->Print();
}

as a result I can not define polyline 
before finishing the macro, which, logically, 
gives error. 
 
root [80] .x test.C
Error: illegal pointer to class object lintst 0x0 178
FILE:/home/martin/devel/nimrod/trun2009/test/./test.C LINE:8
*** Interpreter error recovered ***

after this, I can define polyline in the graphics window. 

my questions is following, is there some easy way 
to force interpreter to wait for the mouse input ?
I tried to use confirmation from keyboard to prevent macro 
proceed further but it does not work. 
When searching roottalk archives I found good deal 
of stuff describing mouse input using ExecuteEvent method 
but I am not sure if this is of some help in the present 
case. Any idea or even examples ?
with best regards
martin



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:40 MET