Signal and slots

Hi,

I have an application in which I display ellipses in a Canvas.
The next feature that I would like to implement is to be able to click with the Left mouse on one of these ellipses and that this action pops up a canvas with some informations related to this ellipse.

To achieve this, I defined a class which is a public class of both TEllipse and TQObject classes.

class Pad:public TEllipse, public TQObject{
void PrintIt(){cout << “clicked” << endl;}
virtual void Clicked(Int_t id) { Emit(“Clicked(Int_t)”,id); }
};

then in the class where i created the different Pad objects, I link the signal and slots.
pad[channel]->Connect(“Clicked(Int_t)”,“Pad”,pad[channel],“PrintIt()”);

Unfortunately this seems not to work at all. Executing the binary output after compilation, I get:

Error in TQObject::CheckConnectArgs: signal TQObject::Clicked(int) does not exist

So my question is namely how to do to click on one TEllipse object and get it poping-up for a canvas for instance.
Thanks for your help.

Hi!

So my question is namely how to do to click on one TEllipse object and get it poping-up for a canvas for instance.

Have you seen this example: $ROOTSYS/tutorials/DynamicSlice.C ?
You can easily change it for the case of clicking.

Konstantin

you’re right. This might solve my problem.
Cheers.

Hi,
check also my reply in “ROOT Support” forum.

Regards. Valeriy