[vtkusers] altering a widgets response to mouse clicks
Totte Karlsson
totte at dunescientific.com
Mon Aug 10 18:51:02 EDT 2015
On 8/9/2015 7:05 PM, Cory Quammen wrote:
> Totte,
>
> The typical way to do this would be to subclass vtkInteractorStyle and
> override the member functions
>
> OnLeftButtonDown()
> OnLeftButtonUp()
> OnMiddleButtonDown()
> OnMiddleButtonUp()
>
> to swap the functionality of the two. My guess is that you are using
> the vtkInteractorStyleTrackballActor, so you could subclass it and
> swap the definitions of the above member functions. Then, set an
> instance of your new class as the interactor style in your
> vtkRenderWindowInteractor.
>
Thanks for the response,
I have now a subclassed a TrackballActor interactor which I am passing
to the widget.
However, the subclassed interactors On*Button() functions are NOT called
as the widget is visible and clicked on. Those overloaded functions are
only called if clicking outside the widget.
I have used the slider widget, and for that one, when clicked on, the
interactors onMouse events are indeed called. The box widget seem to
behave differently.
In addition, as the widget is activated, and an associated callback
Execute function is called, only one type of event is detected, even
though I have added observers for other events.
E.g.
mWidget->AddObserver(vtkCommand::RightButtonPressEvent, mCallBack);
//These are not passed on to the widgets callback??
mWidget->AddObserver(vtkCommand::RightButtonReleaseEvent, mCallBack);
mWidget->AddObserver(vtkCommand::InteractionEvent, mCallBack);
//Only this one seem to be relevant??
I am certainly getting something wrong?
tk
> Hope that helps,
> Cory
>
> On Sun, Aug 9, 2015 at 7:17 PM, Totte Karlsson
> <totte at dunescientific.com <mailto:totte at dunescientific.com>> wrote:
>
> Hello,
> When using a boxwidget, pressing the left button and moving the
> mouse allow the user to rotate the widget,
> while pressing the middle button and moving the mouse translates
> the widget.
>
> How can I switch the behavior of those two buttons?
> I.e. having the left button doing the translation and the middle
> button the rotation?
>
> -tk
> _______________________________________________
> Powered by www.kitware.com <http://www.kitware.com>
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
--
------------------------------------------------------------------------
<http://www.dunescientific.com/>
Totte Karlsson: totte at dunescientific.com
<mailto:totte at dunescientific.com> or (425) 780-9648
<tel:%20425%20%20780-9648>
http://www.dunescientific.com/
© 2015 Dune Scientific, LLC. All rights reserved.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150810/f3840e3f/attachment.html>
More information about the vtkusers
mailing list