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

Marcus D. Hanwell marcus.hanwell at kitware.com
Wed Nov 2 14:12:26 EDT 2011


On Thu, Oct 27, 2011 at 10:39 AM, Natalie <natis261270 at yahoo.com> wrote:
> Hi,
>
> I am new to VTK and switched to the 5.8.0 version yesterday after reading
> about all improvements. I wish to thank everyone involved for all effort in
> making the charts better.
>
> I am searching for an example about how to catch mouse click events (single
> or double) of vtkChartXY. I found out that with
>
> chart->SetClickActionToButton(vtkChart::NOTIFY,
> vtkContextMouseEvent::RIGHT_BUTTON);
>
> I can set an event. Now I need to catch it, but how?
> I started out with VTK 5.6.1 and did
>
> vtkSmartPointer<MouseInteractorStyleDoubleClick> style =
> vtkSmartPointer<MouseInteractorStyleDoubleClick>::New();
> viewQvtkWidget->GetRenderWindow()->GetInteractor()->SetInteractorStyle(style);
>
> according to the DoubleClick example
> http://www.itk.org/Wiki/VTK/Examples/Cxx/Interaction/DoubleClick
> This did work but disabled the pan and zoom functions of the chart.
> With the new VTK 5.8.0 this does not work any longer.
> It would be great if someone could add an example to the example page about
> how to implement single and/or double mouse clicks for vtkChartsXY that also
> shows how to catch or handle the events.

This is probably due to the custom interactor style Julien Finet
added, I think you would have to derive from that style now and add
your custom behaviors there - perhaps Julien can comment further? I
think the class is called vtkContextInteractorStyle.

Marcus



More information about the vtkusers mailing list