Re: call member function with TExec()

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 24 Jan 2006 11:08:21 +0100 (MET)


In TExec you can specify whatever you can specify in a CINT command line.
To invoke a class member function
  -you must have a dictionary for the class   -you must have a pointer to an object of the class know to CINT    (this can be via a global variable)
   you can also invoke a class static function.

Rene Brun

On Tue, 24
Jan 2006, Jochen
Thaeder
wrote:

> Hi,
>
> I want to catch mouse events in a canvas of my GUI. The GUI is implemented as
> one class using QtRoot in a complex framework.
>
> Im trying to call a member function of a class with the TExec() method within
> the same class. I don't want to use macro, because I've to use some member
> variables out of my Class.
>
> Int_t myClass::myFunction() {
> TQtWidget *HistWidget = tQtWidgetGUI;
> ...
> HistWidget->GetCanvas()->AddExec("ex","myExec()");
> ...
>
> }
>
> void myClass::myExec() {
> printf("foo");
> }
>
> But the only thing I get is:
>
> Error: Function myExec() is not defined in current scope FILE:(tmpfile) LINE:1
> Possible candidates are...
> filename line:size busy function type and name
> *** Interpreter error recovered ***
>
> I already looked on the "exec*.C" examples, but they didn't really help me.
>
> What am I doing wrong??
>
> Thanks
> Jochen
>
>
Received on Tue Jan 24 2006 - 11:08:29 MET

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET