Hi,
Root Version: 5.01
OS: Linux RHEL 4
Compiler:3.4.4
I am trying to adapt “exec3.C”, which is an example application of Signal/Slot found in ROOT tutorials.
The problem is that when I call “gPad” for the first time, an error/warning message is given:
“error: non class, struct, union, object …”
The simplest example that shows the symtomp has only 1 extra line (gPad->GetUniqueID() added to 'exec3.C". The example is given below.
I thought gPad is a global variable and it should be known inside the Slot method. Strangely, “gPad->…” seems to return valid results (I think); my adapted application seems to run alright.
Please advise what I can do to avoid the error message. Thank you in advance.
Tim
void exec4()
{
// Example of using signal/slot in TCanvas/TPad to get feedback
// about processed events. Note that slots can be either functions
// or class methods. Compare this with tutorials exec1.C and exec2.C.
TH1F h = new TH1F(“h”,“h”,100,-3,3);
h->FillRandom(“gaus”,1000);
TCanvas c1=new TCanvas(“c1”);
h->Draw();
c1->Update();
c1->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject)", 0, “”,
"exec3event(Int_t,Int_t,Int_t,TObject)");
}
void exec3event(Int_t event, Int_t x, Int_t y, TObject *selected)
{
TCanvas *c = (TCanvas *) gTQSender;
printf(“Canvas %s: event=%d, x=%d, y=%d, selected=%s\n”, c->GetName(),
event, x, y, selected->IsA()->GetName());
gPad->GetUniqueID(); // This call causes an error/warning
}