Re: Tk: how to handle platform differences in keyboard autorepeat?



Ralf Fassel <ralfixx@xxxxxx> writes:

When the user presses a key continuouly, keyboard autoreopeat kicks in
and sends events to the application:

Windows:
<KeyPress-*> // pause
<KeyPress-*> // short pause
<KeyPress-*> // short pause
...
<KeyRelease-*>

Linux:
<KeyPress-*> // pause
<KeyRelease-*> // short pause
<KeyPress-*> // short pause
<KeyRelease-*> // short pause
...
<KeyPress-*> // short pause
<KeyRelease-*> // short pause

How do I handle these differences? E.g if I want to simulate the
loading of a spring: as long as the user presses a key, the spring
gets compressed more and more, and gets released as the user releases
the key. Do I have to take the arrival time of the events into
account and dismiss repeated events if the delta-t is < 1ms?

I think so, yes. I did something like that a while back ... I wonder
where it is. As I recall, there was zero delay between some events,
probably release--press.

http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/bdd9524e3e766ab2

--
Donald Arseneau asnd@xxxxxxxxx
.