Re: Modified

Rene Brun (Rene.Brun@cern.ch)
Thu, 26 Mar 1998 18:36:50 +0100


Wouter Hulsbergen wrote:
>
> Dear Root,
>
> I have divided a canvas in pads with TCanvas::Divide(int,int). In a later
> stage I would like to update the canvas, but some of the pads are
> modified. However, I do not understand how to tell that to the TCanvas.
>
> More concrete:
>
> TH1F* firsthisto = new TH1F(...);
> TH1F* secondhisto = new TH1F(..);
> TCanvas* c1 = new TCanvas();
> c1->Divide(2,1);
> c1->cd(1) ; firsthisto->Draw();
> c1->cd(2) ; secondhisto->Draw();
> firsthisto->Fill(...);
> secondhisto->Fill(...);
> c1->Modified();
> c1->Update();
> // Up to here everything works fine
> firsthisto->Fill(...);
> secondhisto->Fill(...);
> c1->Modified();
> c1->Update();
> // Now the histograms are not changed.
>
> Probably I need to modify each subpad. However, if I try to access them
> with
>
> c1->cd(1); (c1->GetSelectedPad())->Modified();
>
> there is a segmentation fault.
>
> How should I set `modified' for the subpads? Is it possible to set
> `modified' for all subpads at once ?
>
> Regards,
> Wouter

After a statement like c1->cd(1); you can use the global gPad.
gPad by definition always points to the current pad.
For obvious performance reasons, I do not want to force an update
of a pad from TH1::Fill. It is up to you to force the update
at a regular frequency (say every 1000 Fills).
See examples in tutorials hsimple and hsum.

Rene Brun