[vtkusers] add keypress event in vtkSeedWidget

Erkang Cheng ekyaya at gmail.com
Tue Dec 16 20:09:11 EST 2014


Hi all,

I am playing with the vtkSeedWidget example, which is available from:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/SeedWidget

I am stuck at how to add kepress event.

I tried to add
 seedWidget->AddObserver(vtkCommand::KeyPressEvent,seedCallback);

right after the following lines:
 seedWidget->AddObserver(vtkCommand::PlacePointEvent,seedCallback);
  seedWidget->AddObserver(vtkCommand::InteractionEvent,seedCallback);


 Another change is in class vtkSeedCallback::Execute
I add one if-else blcok to capture keypress event.

virtual void Execute(vtkObject*, unsigned long event, void *calldata)
    {
      if (event == vtkCommand::KeyPressEvent)
       {
          std::cout<<"key press"<<std::endl;
       }

...

}


However, the widget can not capture keypress event.

Could anyone share the idea to add customized event in vtkSeedWidget?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141216/11acefd9/attachment.html>


More information about the vtkusers mailing list