[vtkusers] How to activate KeyPress Events in vtkXRenderWindowInteractor?

Luca Pallozzi Lavorante lplavorante at gmail.com
Wed Mar 28 18:13:43 EDT 2007


Hi everybody,
I am trying to use a KeyPressEvent in my application using some test
callback. I have followed the procedure listed below,  but when I press a
key nothing happens.
Could someone please tell me if I am missing something?
Thank you very much for your help.

       Luca

Code:

vtkXRenderWindowInteractor *iren = vtkXRenderWindowInteractor::New();

vtkCallbackCommand *keyPressCB = vtkCallbackCommand::New();
  keyPressCB->SetClientData(iren);
  keyPressCB->SetCallback (keyPressCallback); //  keyPressCallback is
created elsewhere. It prints a message.

vtkInteractorStyleTrackballCamera *styleTrackball =
vtkInteractorStyleTrackballCamera::New();
  styleTrackball->AddObserver(vtkCommand::KeyPressEvent, keyPressCB);

iren->SetInteractorStyle(styleTrackball);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070328/47966371/attachment.htm>


More information about the vtkusers mailing list