[vtkusers] TimerEvent: how and where do I start it?

Nico Vermaas vermaas at astron.nl
Wed Mar 19 07:37:20 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?

Greetings,


Nico Vermaas

Westerbork Radio Telescope
The Netherlands




More information about the vtkusers mailing list