[vtkusers] vtkButtonWidget event not fireing (c#)

jesper1266 jjh at dantecdynamics.com
Mon Nov 5 10:00:56 EST 2018


Hi I'm trying to get a LeftButtonPressEvt to fire from a vtkButtonWidget.
The button shows up in the UI and is able to be pressed whit the left mouse
button, but the assosciated eventhandler is never executed. My code looks as
follows:

public static void ButtonPressedEvent(vtkObject sender, vtkObjectEventArgs
e)
        {
            System.Diagnostics.Trace.WriteLine("left mouse button pressed");
        }

.
.
.

interactorStyle = vtkInteractorStyleTrackballCamera.New();
m_renderWindow.GetInteractor().SetInteractorStyle(interactorStyle);

vtkButtonWidget buttonWidget = vtkButtonWidget.New();
buttonWidget.SetRepresentation(representation);
buttonWidget.LeftButtonPressEvt += new
vtkObject.vtkObjectEventHandler(ButtonPressedEvent);
buttonWidget.SetInteractor(m_renderWindow.GetInteractor());
buttonWidget.On();

If I hook the event handler up to the interaction style like below it works
(except when the mouse is over the button)
interactorStyle.LeftButtonPressEvt += new
vtkObject.vtkObjectEventHandler(ButtonPressedEvent);

I've trawled the lists and google for a solution, but have been unable to
find any answers.
Any help will be greatly appreciated, thank you :-)



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list