[ROOT] Strange problem with gPad

From: Chih-hsiang Cheng (chcheng@SLAC.stanford.edu)
Date: Fri Oct 19 2001 - 01:24:17 MEST


Hi,

  I run a macro like this:

void gpad(Int_t p=0) {
  for(Int_t index= 0; index < 1; index++) {
    if (p==1) {
      TCanvas *subcanvas= new TCanvas("canv","canv",800,950);
      gPad->SetTopMargin(0.04);
    }
  }
}

and it dies like this

root [1] .x gpad.cc(0)
Error: non class,struct,union object $gPad used with . or -> FILE:gpad.cc LINE:5
*** Interpreter error recovered ***

It looks very strange to me since that line (gPad->...) is never executed.
It runs fine with .x gpad.cc(1) !

If I modify the macro to be

void gpad(Int_t p=0) {
  if (p==1) {
    TCanvas *subcanvas= new TCanvas("canv","canv",800,950);
    gPad->SetTopMargin(0.04);
  }
}

it runs fine either with gpad.cc(1) or gpad.cc(0).

Anybody has an idea what's going on?
I use 3.00/06 .

Chih-hsiang



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:03 MET