[vtkusers] timer events

Nico Vermaas vermaas at astron.nl
Mon Mar 31 04:48:21 EST 2003


Hi guys,

I am struggling with TimerEvents

I have used AddObserver to watch for a TimerEvent from my vtkWindowInteractor (and later I tried it from vtkXWindowInteractor).
But the TimerEvent only comes when I manually interact with the window like start a rotation.


the event handler:
-------------------------------------------------
void myEventHandler(vtkObject* caller, unsigned long eventId, void* ClientData, void* data) {

switch (eventId) {
 case vtkCommand::TimerEvent:
    MyUpdate();
       break;
}
------------------------------------------------------

the observer:
-------------------------------------------------------------------------------------
 vtkCallbackCommand *cbc = vtkCallbackCommand::New();
 cbc->SetCallback(myEventHandler);

 interactor->AddObserver(vtkCommand::TimerEvent,cbc);
--------------------------------------------------------------------------------------

I have changed my interactor to vtkXWindowInteractor (I am working in Linux), but to now avail.

------------------------------------------
interactor=vtkXRenderWindowInteractor::New();
    
interactor->CreateTimer(10);
interactor->Initialize();
interactor->Start();
------------------------------------------

So, how do I start a timer?

Thanks,


Nico Vermaas



 




More information about the vtkusers mailing list