LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Key down repeat event slowly catching up to keyboard buffer

I added a keydown repeat event to my loop so I can make the object on the screen move continuously until the key is released.  This does work with the drawback of my program cycle running 70ms, which I'm guessing means the keyboard buffer is filling up during those 70ms while the key is still being held down.  So when I do finally release the key it takes quite a few more cycles til the object stops moving on the screen.   So what i'm asking is,  Is there a way to clear this buffer before checking the next key event, or is there something else I can be doing that I haven't seen yet?
0 Kudos
Message 1 of 2
(3,281 Views)

The problem is that updating the display takes considerably longer than the time it takes for the Key Repeat event to fire.

I would suggest you move the actual moving code to a parallel process. Then, transfer the data to that process. This can be done, for example, using a notifier or a queue. This makes it convenient, because you can set an infinite timeout on the wait and then the process won't loop until the notifier is updated. This will allow you to move the object on screen in greater leaps. It won't work as smoothly, but it should avoid the buffering.


___________________
Try to take over the world!
0 Kudos
Message 2 of 2
(3,269 Views)