[vtkusers] vtkChartXY: How to catch mouse click events, user interaction? (VTK 5.8.0)

Julien Finet julien.finet at kitware.com
Thu Nov 3 09:39:38 EDT 2011


Hi Natalie,

As you found out, there are a couple of ways of handling/catching events in
the VTK charts.
Due to the last changes, I'm not 100% sure they are all compatible with
each other anymore. Feel free to report any issue you see.

You can look at what is done in vtkControlPointsItem.h/cxx for a fine
control of mouse events (e.g. vtkControlPointsItem::MouseDoubleClickEvent).

To give you the big picture:
vtkContextInteractorStyle is the interactor style for all the charts (we
might want to revise it and support custom styles as you mentioned). It
listens to the render window interactor and propagates the mouse/keyboard
events to the scene, the scene checks on what vtkAbstractContextItem the
event is called on, and propagates the event to the item.
ChartXY items (which are not 100% of the vtk charts) have their own event
mechanism to handle events at a higher(simpler) level, they still receive
the events from the scene and by registering what event you are interested
in, you can have custom behavior. You might have to add double click high
level support for the chartXY items.

Julien.

On Wed, Nov 2, 2011 at 2:34 PM, Natalie <natis261270 at yahoo.com> wrote:

> Hi Marcus,
>
> thanks a lot for your reply.
> After a long search for the correct class, I found out that I need to
> subclass vtkContextInteractorStyle.
>
> However, in the constructor of vtkContextView the instance is created. The
> following lines are from the constructor:
>
>  vtkContextInteractorStyle* style = vtkContextInteractorStyle::New();
>  style->SetScene(this->Scene);
>  this->GetInteractor()->SetInteractorStyle(style);
>
> Probably, I also need to subclass the vtkContextView and change the
> constructor. A little too complicated I thought. I still hope that there is
> an easier way.
> I am looking forward to more ideas :-)
> Natalie
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/vtkChartXY-How-to-catch-mouse-click-events-user-interaction-VTK-5-8-0-tp4943170p4958959.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111103/4f88e41c/attachment.htm>


More information about the vtkusers mailing list