Keypress Help

Dar Scott dsc at swcp.com
Mon Apr 18 16:21:59 EDT 2005


On Apr 18, 2005, at 12:48 PM, Scott Rossi wrote:

> How can one reliably tell on Windows when a key is pressed versus when 
> it is
> released?

(An external?)

Here is an idea that might work.

Here is what I see with rawKeyDown and rawKeyUp:

When the key is pressed, a rawKeyDown is sent.  As the key is held down 
then a sequence of rawKeyDown/rawKeyUp pairs are sent.  Then a rawKeyUp 
is sent.

So maybe you can use a counter that is incremented with down and 
incremented with up and call the key down if it is not zero.  If 
neither up or down has come in in some period of time clear the 
counter, making the key up.

(There might be some other scheme based on the down/up pairs being 
close together if that doesn't work.)

Dar

-- 
**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     A Sponsor of RevCon West
**********************************************



More information about the use-livecode mailing list