[vtk-developers] SetCallbackMethod, add new keyPressEvent

Minsuk Park ashtonpark7 at gmail.com
Mon Feb 19 02:04:52 EST 2018


Hi!
I'm pretty much beginner of vtk and its application.

I applied vtkContourWidget on renderWindow and hope to add a new
keyPressEvent on it.
So I am now trying to change the vtkContourWidget.cxx file directly and add


*this->CallbackMapper->SetCallbackMethod(vtkCommand::KeyPressEvent,*
*   vtkEvent::NoModifier, 13, 1, "Return",*
*   vtkWidgetEvent::Reset,*
*   this, vtkContourWidget::ResetAction);*

this for new Action when I pressed Return(I guess it is "Enter"), which
acts ResetAction when Shift+Del is pressed like behind

*this->CallbackMapper->SetCallbackMethod(vtkCommand::KeyPressEvent,*
*                                          vtkEvent::ShiftModifier, 127, 1,
"Delete",*
*                                          vtkWidgetEvent::Reset,*
*                                          this,
vtkContourWidget::ResetAction);*

However, "Return" doesn't work and I couldn't figure it out.
I am pretty much sure that I am not supposed to add the keyPressEvent in
this way,
but I don't know what to do.

How can I add a new keyPressEvent for a new key on vtkWidget?

-- 
--------------------------------------------------------------------------------------------------------------
*Minsuk Park*
Mobile: +82-10-7329-9912
Email: ashtonpark7 at gmail.com
--------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtk-developers/attachments/20180219/93642429/attachment.html>


More information about the vtk-developers mailing list