RE: TPad::GetPrimitive

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Wed, 8 Jun 2005 16:32:14 +0200


Add gPad->Update() after h->Draw().

O.

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910

E-Mail: Olivier.Couet_at_cern.ch                            Phone:   +41 22
7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22
7670300

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Carlos Munoz Camacho
Sent: Wednesday, June 08, 2005 4:11 PM
To: roottalk (Mailing list discussing all aspects of the ROOT system)
Subject: [ROOT] TPad::GetPrimitive


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:32:21 MEST

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