Re: [ROOT] How do I retreive pointers to Editor created - objects in root?

From: Valeri Fine (fine@bnl.gov)
Date: Fri Jun 07 2002 - 18:18:32 MEST


Hello

I guess what you are looking for is

TLine * l =  dynamic_cast<TLine *>(gPad->GetSelected());

http://root.cern.ch/root/htmldoc/src/TPad.cxx.html#TPad:GetSelected



> Hi Annalisa,
> Thanks!
> Your empirical Idea is fair!
> But unfortunately form the canvas.C i see that  Root initialises with the 
> name "line" 
> one  TLine pointer at first, for the first 
> TLine; then Root reassigns to the same pointer all the
> next TLines I draw.......
> 
> Nevertheless I can modify at any time, with the mouse, all the TLines I 
> have 
> drawn. This means that  Root must keep into some of its memory the 
> information about the ID 
> of each TLine. 

  Of it does and this pointer can be found some how.

> I need to know (for implementing an automathic routine) 
> such an address for each TLine!

 However I would not advice you too look for that pointer. 
 I think it is not proper solution.
Well I don't know your task and what you are tring to achieve.

  HOwever the generic advice is.

 1. Derive your own class from TLine
 2. Overload  DistanceToPrimitve method








a De Caro wrote:
> 
> >   Hi Tommaso,
> > i don't understand very well your question.
> > If you need to know the pointer to the lines drawn in a canvas, you can
> > save this canvas as .C file and you can see the file content;
> >    ex:
> >        root [0] new TCanvas();
> > open the Editor menu, clik on Line button and draw the first line on the
> > canvas, clik on Line button an other time and draw the second line ...
> > Then, you can go on File menu and in Save As canvas.C;
> > the file c1.C was created. You can see the content...
> > I don't know if this can help you...
> >   Ciao 
> >                Annalisa
> > 
> > > Hi Rooters, 
> > > My question in the subject is because if i draw a TLine with the Editor on 
> > > a plot, 
> > > I get a pointer to it simply with 
> > > 
> > > TLine *l = TLine;
> > > 
> > > 
> > > But if I draw more than one line, I don't know how to get the pointer to 
> > > the newer ones. (If I right-click with the mouse on the line, i get as the 
> > > header name TLine only, instead of for example TLine::pippo).
> > > 
> > > Anyone can help?
> > > 
> > > Thanks a lot,
> > > Tommaso
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> 



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:56 MET