Re: [ROOT] gROOT->GetSelectedPad()

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Dec 19 2000 - 12:13:22 MET


Andre,
Add the line
  c5->Update();
after the line
  c5->Divide(3,2);

Otherwise, when you call gROOT->GetSelectedPad, there is no canvas
"Paint" at this time.

Rene Brun

Andre Holzner wrote:
> 
> Hello,
> 
> what am I doing wrong with this macro ?
> The first time I run it, it produces an empty canvas
> (and I see the complaint messages). Running it again,
> I get a new canvas with all the frames in it (as I
> want them). Can anybody reproduce the problem ?
> 
> void test()
> {
>   TCanvas *c5 = new TCanvas;
>   c5->cd();
>   c5->Divide(3,2);
> 
>   int i;
>   for (i=0; i<6; ++i)
>     {
>       c5->cd(i+1);
> 
>       TPad *pad = gROOT->GetSelectedPad();
>       if (pad == NULL)
>         cout << "GetSelectedPad() returns NULL" << endl;
>       else
>         pad->DrawFrame(105,-8,120,8);
>     }
> }
> 
> thanks for looking at it,
> 
> Andre
> 
> --
> ------------------+----------------------------------
> Andre Holzner     | +41 22 76 76750
> Bureau 32 2-C13   | Building 32
> CERN              | Office 2-C13
> CH-1211 Geneve 23 | http://wwweth.cern.ch/~holzner/



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:39 MET