Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 14 Sep 2009 15:43:37 +0100
Hi!
Here is a bit of script that can show that OnKeyUp event not addressing every control key by its name. Instead of "SPACE" and "ENTER" I have to use ascii codes of these keys and change to Switch Asc(msg.key). What is the concept for such behaviour? I know that enter and space are displayable, so it has ascii codes, but IsKeyDown() can handle them by name. At least a bit of info in the guide would clarify the situation for newbies.
Function p_key(msg)
Switch msg.key
Case "UP":
Print("up")
Case "DOWN":
Print("down")
Case "SPACE":
Print("space")
Case "ESC":
Print("esc")
Case "ENTER":
Print("enter")
EndSwitch
EndFunction
InstallEventHandler({Onkeyup=p_key})
Repeat
WaitEvent
Forever
Function p_key(msg)
Switch msg.key
Case "UP":
Print("up")
Case "DOWN":
Print("down")
Case " ":
Print("space")
Case "ESC":
Print("esc")
Case "\n":
Print("enter")
EndSwitch
EndFunction
InstallEventHandler({Onkeyup=p_key})
Repeat
WaitEvent
Forever
If msg.key would contain "SPACE" now for every space press, it would be pretty annoying. Same for RETURN, ENTER etc. Well, but it all depends on the circumstances of course. In your case it's probably the other way round