Two TRootEmbeddedCanvas's causes a loss connection

Hi guys,

I created a TRootEmbeddedCanvas that has an array of TEllipses I use as “buttons.” When you click on any TEllipse, it would print to screen the array value+1. If I create another TRootEmbeddedCanvas, that functionality stops working. It seems the recently created TRootEmbeddedCanvas is the only one program accepts signals from. I attached a small version of it.

Thanks in advance,
Surge
guitest.C (7.62 KB)

For those who are interested, I found a solution by adding the line

fCanvas->GetCanvas()->Connect("Selected(TVirtualPad*,TObject*,Int_t)", "Main", this, ChangeCanvas(TVirtualPad*,TObject*,Int_t)");
In the Main class constructor and adding another function to the Main class

void ChangeCanvas(TVirtualPad* pad, TObject* sel, Int_t evt) { int x = pad->GetCanvas()->GetSelectedX(); int y = pad->GetCanvas()->GetSelectedY(); fCanvas->GetCanvas()->ProcessedEvent(evt, x, y, sel); }
And it worked without me clicking on the middle mouse button to select the proper TRootEmbeddedCanvas. It didn’t matter which TRootEmbeddedCanvas was active.

Surge