Flipping graphic with a Key
Ben Rubinstein
benr_mc at cogapp.com
Wed Oct 13 18:34:16 EDT 2010
On 13/10/2010 22:33, Michael Kristensen wrote:
> Thanks for the reply's
>
> I m sorry to report that neither
..
>
> or
...
> .......did have any effect on stopping the repeated keyDown.
I don't think you can stop the repeated keyDown; the OS will keep sending the
keyDown events, LiveCode will keep reporting them to your code. Nor would
cunning schemes with carefully calibrated time work (except perhaps if you
only want this to work on a single machine that you have control over) since
the user can adjust the speed of key repeat, and the delay before first repeat.
However, have you tried Jim Lambert's suggestion of using the keyUp event?
AFAIK, LiveCode processes auto-repeating keys (at least on Mac) as repeated
keyDown events; but it only sends a keyUp event when the key is released. So
if you set a flag when you flip the graphic on the first keyDown; ignore
subsequent keyDown events if the flag is still set; and then unflip, and clear
the flag, on a keyUp event, that should work.
If you really want to monitor the state of a key, you'll need to switch to
using one of the keys that is treated as having 'up' and 'down' states, such
as shift, alt or control, rather than the regular keys which don't so much
have a state, rather have events (keyDown, keyUp).
Ben
More information about the use-livecode
mailing list