Hello Frederic
In the compiled code "gPad" is defined as follows:
TVirtualPad.h:
static TVirtualPad *&Pad();
#define gPad (TVirtualPad::Pad())
If you want to change the gPad value you should apply "cd()" method rather the
assigment operator, namely:
cout << gPad << endl;
if (Pads==0)
{
...
// --- NO gPad = (TPad*)gPad->GetMother();
gPad->GetMother()->cd();
...
}
else
{
cout << gPad << endl;
...
}
Hope this helps,
-----
Dr.Valeri Fine
STAR/US Atlas E-mail: fine@bnl.gov
Brookhaven National Lab Phone: +1 631 344 7806
Upton, NY 11973-5000 FAX: +1 631 344 4206
USA
----- Original Message -----
From: "Frederic Sarazin" <sarazin@triumf.ca>
To: <roottalk@pcroot.cern.ch>
Sent: Friday, February 15, 2002 8:49 PM
Subject: [ROOT] Compiler/Interpreter ?
> Hello Root'er,
>
> In my program (a script that I load with the .L command), I've got
> the following lines:
>
> cout << gPad << endl;
>
> if (Pads==0)
> {
> ...
> gPad = (TPad*)gPad->GetMother();
> ...
> }
> else
> {
> cout << gPad << endl;
> ...
> }
>
> In my case, the value of "Pads" is not 0... so the two print-out of
> gPad should
> be identical. I trace the problem down to the command I left in the if
> loop... the
> problem is that this part is not accessed by the program when executed.
>
> I tried a few other things (use of a temporary variable then a copy of
> the pointer
> into gPad, a difference cast...) but nothing seems to work.
>
> Thanks for your help.
>
> Fred
>
>
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:41 MET