[vtkusers] Handling "holding down" a key

David Doria daviddoria+vtk at gmail.com
Sun Sep 12 11:20:42 EDT 2010


On Sun, Sep 12, 2010 at 10:35 AM, David Gobbi <david.gobbi at gmail.com> wrote:
> Hi David,
>
> The "key repeat" is done by the operating system, not by VTK.  The
> only keys that do not repeat are the modifier keys: shift, control,
> alt, etcetera.  What key are you using, and on what operating system
> or GUI toolkit?
>
> The work-around is to add a timer to your code, so that if a repeat
> occurs within a certain number of milliseconds you can ignore it.
>
>  David

I am on Fedora 13, using the 'x' key, and from a standard
vtkRenderWindow (no GUI toolkit).

I am trying to modify vtkInteractorStyleTrackballActor to allow the
user to "lock" the translation or rotation of an actor to a single
axis at a time. That is, if I'm holding the 'x' key while translating
the actor (moving the mouse with the middle mouse button held down) I
want the actor only to move along the x axis. I guess the easy fix is
to do this by toggling the flag with a keypress rather than dealing
with using a timer to allow the key to be held down? The problem is
the user has no way to track the state of this flag - where if he was
holding down the key the state would be obvious!

David D.



More information about the vtkusers mailing list