[vtkusers] vtkRenderWindow catch the arrow keys

Denis Barbier bouzim at gmail.com
Thu Nov 13 15:47:12 EST 2008


On 2008/11/13 Stéphane CALANDE wrote:
> Hi vtk-list,
>
> I have a question about vtkRenderWindow.
>
> I don't manage to catch the hits of arrow keys.
[...]
> if (event == vtkCommand::KeyPressEvent)
>       {
>       int code = ????

>       if ( code == ????(LEFT_ARROW) )
>           {
>                  // CODE
>           }
[...]

You can set DebugOn on your vtkRenderWindowInteractor to print some useful
information. vtkRenderWindowInteractor::GetKeyCode returns a char, so it won't
help.  I guess that you could use GetKeySym instead and check for
Left/Right/Up/Down.
After quickly browsing source files, I believe that these strings are
platform agnostic,
but you will have to check if portability is an issue for you.

Denis


More information about the vtkusers mailing list