[vtkusers] [Java] Removing default shortcut
Sebastien Jourdain
sebastien.jourdain at kitware.com
Wed Mar 28 10:45:39 EDT 2018
If you don't have any issue with (r, u, w, s), you should handle your
keypress event at the Java level. You can not subclass a C++ class in Java
and hope to use it.
If you can not unregistered key press event on the C++ InteractorStyle with
API call then you are in trouble with what you are trying to achieve unless
you picked the wrong interactor style.
HTH,
Seb
On Wed, Mar 28, 2018 at 8:25 AM, Jean-Max Redonnet <jmax.red at gmail.com>
wrote:
> Thanks for taking my problem into consideration
>
> I'm using vtkRenderWindowPanel which inherits from vtkCanvas which
> inherits from vtkPanel (as far I can believe Eclipse).
>
> Hope this may help.
>
> jMax
>
>
> 2018-03-27 17:02 GMT+02:00 Sebastien Jourdain <sebastien.jourdain at kitware.
> com>:
>
>> Are you using vtkPanel or vtkCanvas or something else to bring the
>> rendering into the Java GUI?
>>
>> I see hard coded key press handling within vtkPanel (r, u, w, s).
>>
>> Seb
>>
>> On Tue, Mar 27, 2018 at 6:04 AM, Jean-Max Redonnet <jmax.red at gmail.com>
>> wrote:
>>
>>> Hello everyone,
>>>
>>> I'm trying to define my own shortcuts for my app, but I can't figure out
>>> how to remove existing shortcuts.
>>>
>>> First, I wonder if the best way to do that is using the Swing/AWT
>>> architecture or the VTK one. I tried both, both allow me to define new
>>> shortcuts, but none of them allow me to remove individual default shortcut.
>>>
>>> I tried to subclass vtkInteractorStyle as in this example :
>>> https://lorensen.github.io/VTKExamples/site/Cxx/Interaction/
>>> KeypressEvents/
>>>
>>> The direct C++ to Java translation just do nothing. The custom
>>> interactor style is never called. But default shortcut is still registred
>>> ('q' key quits and so on...)
>>>
>>> I also tied to remove all keybord related interactor observers to make
>>> the whole shortcuts managed by Swing/AWT. To do this, I wrote :
>>>
>>> renderWindowInteractor.RemoveObservers("KeyPressEvent");
>>> renderWindowInteractor.RemoveObservers("KeyReleaseEvent");
>>> renderWindowInteractor.RemoveObservers("CharEvent");
>>>
>>> but it did not work either.
>>>
>>> All this stuff seems to work properly with other languages than Java. Is
>>> there is something special with Java ?
>>>
>>> I must admit I'm a bit confused. Any help would be gratefully
>>> appreciated. Thanks.
>>>
>>> JMR
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>>
>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> https://vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180328/68a28e28/attachment.html>
More information about the vtkusers
mailing list