[vtkusers] How to handle different keys events?

Jonathan Bailleul Jonathan.Bailleul at greyc.ismra.fr
Fri Apr 4 11:50:54 EST 2003


Dear all,

I managed to handle 'any key' event using the code below. My problem is
that I'd be happy to discriminate keys, and I really can't figure out
how (even if you could notice I significantly advanced since my last
post). can anybody help?

Thanks in advance.



void 
vectraEventHandler(vtkObject* caller, unsigned long eventId, void*
ClientData, void* data) 
{
  switch (eventId) {
  case vtkCommand::TimerEvent:
    cout << endl << "TimerEvent";
    break;
  case vtkCommand::KeyPressEvent:
    {
     something for any key
    }
    break;
  default:
    cout << endl << "UnhandledEvent";
  }
}

and in main section:

  vtkCallbackCommand *cbc = vtkCallbackCommand::New();
  cbc -> SetCallback(vectraEventHandler);

  iren -> AddObserver(vtkCommand::KeyPressEvent, cbc);
  

-- 
-----------------------------------
Jonathan BAILLEUL, Doctorant
GREYC Image - Université de Caen 
http://www.greyc.ismra.fr/~bailleul



More information about the vtkusers mailing list