TTimer::SetCommand usage

Hello,
I have a little problem using TTimer to periodically call a member method.
I create the timer in my constructor InfoControl and I want the RequestInfo() to be called periodically.
I tried like this :

TTimer *timer = new TTimer(1000); timer->SetCommand("RequestInfo()"); // I also tried "InfoControl::RequestInfo()" timer->TurnOn();

But I get :
Error: Function RequestInfo() is not defined in current scope (tmpfile):1:
*** Interpreter error recovered ***

It might be very trivial, but I’m stuck…

Thanks in advance for help,
eo

Edit : I also tried declaring RequestInfo() as a function (not a method). Like in the CPUMeter.C example. And it doesn’t work either.

Hi,

Could you provide a running piece of code showing the problem?

Cheers, Bertrand.

Hello,
thanks for reply Bertrand.
I finally found out how to get it working.

timer = new TTimer(); timer->Connect("Timeout()", "InfoControl", this, "RequestInfo()"); timer->Start(1000, kFALSE);

Merci,
bye.

Hi,

You’re welcome. And glad to see that you solved your problem! :slight_smile:

Cheers, Bertrand.