[vtkusers] Handling "holding down" a key

David Gobbi david.gobbi at gmail.com
Sun Sep 12 11:30:29 EDT 2010


Hi David,

Clicking the 'x' key to change the state is preferable.  You just need
to add a visual cue to inform the user of the current state, e.g. you
can change the shape of the mouse cursor or draw a horizontal arrow
somewhere.

  David


On Sun, Sep 12, 2010 at 9:20 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
> 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