On Mar 4, 2008, at 19:19 , stan shepherd wrote:

handleKeyUp: anEvent
        Transcript show: ' evt is down ',anEvent isKeyDown asString; cr.
        "now press and hold a key"

shows

 evt is down false

Which is of course expected since only keyUp events are passed into #handleKeyUp:, so #isKeyDown always is false.

You need to handle both keyDown and keyUp events, and track the state of pressed keys.

Note that the keyValue in up/down events is system-specific (unlike keyStroke events which have actual characters).

Also note that this behavior also depends on your OS and VM version. The Windows VM handles up/down events nicely for a long time, Mac VMs since recently, Unix VMs are broken I think.

I'm attaching a small example morph demonstrating this.

- Bert -

Attachment: BertsKeys.st.gz
Description: GNU Zip compressed data

_______________________________________________
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners

Reply via email to