Re: gPad

From: Rutger van der Eijk (r36@nikhef.nl)
Date: Mon Feb 28 2000 - 13:19:01 MET


Hi Fons,

If I execute the macro

{
  // create pad
  if (!Pad()) {
    if (!gROOT->GetMakeDefCanvas()) return;
    (gROOT->GetMakeDefCanvas())();
  }
  Pad()->Clear();

  // creat view
  TView *view = Pad()->GetView();
  if (!view) {
    view = new TView(1);
    view->SetRange(-100, -100, -100, 100, 100, 100);
  }
}

I get:

root [0] .x PadTest.C   
Error: illegal pointer to class object Pad() 0x0 218
FILE:/afs/cern.ch/user/r/rutger/mycmt/ot/RootTest/v5/macros/PadTest.C
LINE:7
*** Interpreter error recovered ***

I also noticed tab-completions doesn't work for Pad() ...

Rutger

On Mon, 28 Feb 2000, Fons Rademakers wrote:

> Hi Rutger,
> 
>    in the current version gPad is actually a function with the name Pad().
> So you can use if (Pad())... However, due to possible name clashes with
> other global functions from other libraries we've changed Pad() to R__Pad()
> in the coming release. So, use Pad() now and change to R__Pad() when you 
> get the next release.
> 
> Cheers, Fons.
> 
> 
> Rutger van der Eijk wrote:
> > 
> > Hi,
> > 
> > When is gPad known in an interactive ROOT session? I know gPad became a
> > macro to improve thread support. However if I just start interactive ROOT,
> > gPad is not know until I draw some object. This is inconvenient because I,
> > e.g. want to check if a canvas is already present.
> > 
> > i.e. the macro
> > 
> >   // create pad
> >   if (!gPad) {
> >     if (!gROOT->GetMakeDefCanvas()) return;
> >     (gROOT->GetMakeDefCanvas())();
> >   }
> >   gPad->Clear();
> > 
> > crashes with:
> > 
> > Error: No symbol gPad in current scope  FILE:/tmp/29646eaa_cint LINE:1
> > 
> > I probably missed a roottalk or release note about this (because more ppl
> > should have this), or am doing something stupid. Can anybody point me out
> > to the documentation? (Version   2.23/12   1 February 2000)
> > 
> > cheers,
> > 
> > Rutger
> 
> -- 
> Org:    CERN, European Laboratory for Particle Physics.
> Mail:   1211 Geneve 23, Switzerland
> E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
> WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910
> 



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