Standalone onMouseClick

Hi,

I’m trying to have my standalone C++ code write when an onMouseClick event has occured inside a TCanvas window that I open.

My code is:

...
#include <RQ_OBJECT.h>
class MyDisplay {
RQ_OBJECT("MyDisplay")
 public:
   MyDisplay ();
   ~MyDisplay();
...
   void draw();
   void respond(Int_t event, Int_t x, Int_t y, TObject *selected);
}

And:

...
#include <TQObject.h>
void MyDisplay::draw()
{
   xLayers = new TCanvas("xLayerCanvas", "X Layer Canvas");
...
   xLayers->Update();
   xLayers->Draw(); // canvas window opens
   xLayers->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)","MyDisplay",this,"respond(Int_t,Int_t,Int_t,TObject*)");
...
}

void MyDisplay::respond(Int_t event, Int_t x, Int_t y, TObject *selected)
{
   if (event==kButton1Down){
      TCanvas *c = (TCanvas *) gTQSender;
      printf("Canvas has been clicked\n");
}

However, I keep getting:
Error in TQObject::CheckConnectArgs: slot respond(int,int,int,TObject*) does not exist

What am I doing wrong?

Thanks,
Nir

Hi Nir,

Please see the topic root.cern.ch/phpBB2/viewtopic.php?t=1525 and check your case with the provided example there. Using signals/slots requires dictionary information - have you created a LinkDef for MyDisplay class?

Cheers, Ilka