Re: TPad::GetPrimitive

From: Rene Brun <brun_at_pcroot.cern.ch>
Date: Wed, 8 Jun 2005 16:37:00 +0200 (MEST)


Insert one line

   gPad->Update();
between
h->Draw
and
  TPaveStats *st=(TPaveStats*)gPad->GetPrimitive("stats");

Rene Brun

On Wed, 8 Jun
2005, Carlos Munoz Camacho wrote:

>
> Hi,
>
> If I type in a ROOT session:
>
> TH1F *h=new TH1F("h","h",100,-1,1);
> h->Draw();
> TPaveStats *st=(TPaveStats*)gPad->GetPrimitive("stats");
> st->SetX1NDC(0.1);
> h->Draw();
>
> that works fine. Now if a do it in a macro (adding a couple of {} ):
>
> {
> TH1F *h=new TH1F("h","h",100,-1,1);
> h->Draw();
> TPaveStats *st=(TPaveStats*)gPad->GetPrimitive("stats");
> st->SetX1NDC(0.1);
> h->Draw();
> }
>
> ROOT complains like this:
>
> Error: illegal pointer to class object st 0x0 323 FILE:(tmpfile) LINE:5
> *** Interpreter error recovered ***
>
> This is ROOT 4.00/08 on Linux. Any hints ?
>
> Carlos
>
> Is there any other (better) way of changing the size of the statbox ?
>
>
Received on Wed Jun 08 2005 - 16:37:05 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:09 MET