detecting for how long a key is being pressed

Nicolas Cueto cuetojp at yahoo.co.jp
Tue Sep 6 18:01:53 EDT 2005


Like Jacqueline, I too was going to suggest
"keyDown" and "keyUp". Howerver, trying it 
out first for myself, I discovered that the keyDown
message is generated not only the first time 
a key pressed but continues to be generated
so long as the key is held down. This of course
results in the repeated resetting of the variable
storing the start-time. As well, oddly enough, the
keyUp message is also being generated despite
the targeted key's being continuously held down.
I know this because in the keyUp handler I put it
a "put tTotalTime in field "fTimer"", and, while
the targeted key is held down, the text in that
field continually blinks.

For solutions, I tried exiting the keyDown handler
by either escaping if the time-variable wasn't empty
or using "exit" and "pass".

Is this perhaps a system-specific result? I'm 
on Win2k.

Anyway, I'll append my script below, in case 
someone's got a solution.

Cheers,
Nicolas Cueto
niconiko language school

##### THE CARD SCRIPT






More information about the use-livecode mailing list