[vtkusers] change event bindings of vtkHandleWidget

Panayiotis Georgiou ps.georgiou at gmail.com
Wed Apr 23 09:56:40 EDT 2014


Hello everyone.

I am currently using two vtkHandleWidget's in order to interactively modify
the two end-points of a line using the mouse. By default the position of
the vtkHandleWidget's cursor move by pressing the middle mouse button and
dragging while the button is still being pressed.

What I am trying to do is use the left mouse button to translate the cursor
but I do not know how to do this. I have tried modifying the event bindings
using vtkWidgetEventTranslator but this has not worked.

Here is how I tried to change the event bindings:

//========================
vtkWidgetEventTranslator *eventTranslator =
handleWidget->GetEventTranslator();
eventTranslator->RemoveTranslation( vtkCommand::LeftButtonPressEvent  );
eventTranslator->RemoveTranslation( vtkCommand::LeftButtonReleaseEvent  );
eventTranslator->RemoveTranslation( vtkCommand::MiddleButtonPressEvent   );
eventTranslator->RemoveTranslation( vtkCommand::MiddleButtonReleaseEvent
);
eventTranslator->SetTranslation( vtkCommand::LeftButtonPressEvent,
 vtkWidgetEvent::Translate);
eventTranslator->SetTranslation( vtkCommand::LeftButtonReleaseEvent,
 vtkWidgetEvent::EndTranslate);
//========================

After applying the code above the handle stops responding completely to any
events from the Left and Middle mouse buttons and the remapping has no
effect.

Can someone please give me some ideas on how to fix this?

Thanks for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140423/c3c92737/attachment.html>


More information about the vtkusers mailing list