Re: TCanvas::Divide

Rene Brun (Rene.Brun@cern.ch)
Fri, 06 Jun 1997 10:44:03 +0200


Pasha Murat wrote:
>
> Rene Brun writes:
> >
> > We could also implement functions like:
> > TPad::cd(Int_t i)
> > TPad::cd(Int_t i, Int_t j)
> >
>
> It would be very helpful. And 2 following methods
>
> TPad* TPad::Pad(Int_t i);
> TPad* TPad::Pad(Int_t i, Int_t j);
>
> could provide the rest functionality in a convenient form.
> May be it is a matter of personal taste, but
>
> TPad* pad = page->Pad(i);
>
> looks much nicer then
>
> sprintf(padname,"page_%d",i+1);
> TPad* pad = (TPad*)page->GetPrimitive(padname);

TPad::cd(Int_t i) sets the current pad (global gPad). It could also return gPad.
TPad *TPad::cd(Int_t i)

Be careful with using pad by numbers. This is not general. You can do for example:
canvas->Divide(2,4);
and then a new TPad by name. What means the pad number in this case.
You can also move the pads with the mouse in a different order.
Note that when using the function Divide, you can set the current pad simply
by pointing to the pad with the middle mouse button.

Rene Brun