Re: statistics box: text properties (fwd)

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Feb 10 1999 - 08:24:24 MET


S.J.M. Peeters wrote:
> 
> Hi ROOTers,
> 
> Some time ago I asked the question how to change the text sizeof my stats
> box (which I need to do, because the text is automaticly to big and there
> are smaller fonts). I got the following advice:
> 
> -------------------------------------------------------------------------
>   TPaveText *stats = (TPaveText*)gPad->GetPrimitive("stats");
>   stats->SetTextSize(0.03);
> -------------------------------------------------------------------------
> 
> This however never works. If I ask my pad to print the list of primitives
> I only find my histogram and no "stats". So thisTPaveText* is a NULL
> pointer )-:
> 
> Is there any way to still acces this TPaveText?
> 

Hi Simon,
The "stats" TPaveText object is created when the histogram is drawn.
If you execute a macro, you must force an Update of the canvas to get
the histogram drawn. The Draw function simply adds the histogram to the
list
of objects to be drawn when the canvas is updated.
Here is a small macro illustrating how to operate.

{
   hpx->Draw();
   gPad->Update();
   TPaveText *stats = (TPaveText*)gPad->GetPrimitive("stats");
   stats->SetTextSize(0.02);
   gPad->Modified();
}

Rene Brun



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