Page 1 of 1
"SPACE" bar doesn't work
Posted: Mon Jun 18, 2012 11:58 am
by Juan Carlos
Yes, the "SPACE" bar in OnKeyDown doesn't wotk under Windows and neither undert AmigaOS4 but other key as 'BACKSPACE’ yes and the others keys as the capital letters, ESC key but not "SPACE" why?
Re: "SPACE" bar doesn't work
Posted: Mon Jun 18, 2012 6:44 pm
by airsoftsoftwair
You must look for " " instead of "SPACE", e.g.
Code: Select all
Switch msg.action
Case "OnKeyDown":
If msg.key = " " Then NPrint("Space pressed")
EndSwitch
Re: "SPACE" bar doesn't work
Posted: Mon Jun 18, 2012 11:18 pm
by Juan Carlos
Andreas wrote:You must look for " " instead of "SPACE", e.g.
Code: Select all
Switch msg.action
Case "OnKeyDown":
If msg.key = " " Then NPrint("Space pressed")
EndSwitch
Anda, I'm surprised because I think that is "SPACE" not " " this is my mistake, thinking as a leeter name, thanks Andreas but in the guide and manual you have specify this case to avoid the mistake of to think in bar name.
Re: "SPACE" bar doesn't work
Posted: Tue Jun 19, 2012 12:07 am
by airsoftsoftwair
It's left as an exercise for the reader

Re: "SPACE" bar doesn't work
Posted: Tue Jun 19, 2012 12:56 am
by djrikki
All joking aside, its not so amusing for TAB which you have to type:
- yes 8 spaces
and return is "\n" - obvious to me, but maybe not for others. Shame TAB and SPACE keys don't just work as documented as it tooks me ages to discover the real solution!
Re: "SPACE" bar doesn't work
Posted: Tue Jun 19, 2012 1:02 am
by djrikki
Here's one for you Andreas:
Code: Select all
Function afunction(msg)
Switch msg.action
Local key = UpperStr(msg.key)
EndSwitch
EndFunction
How will HW handle /n and other relevant char codes that there might be?
Re: "SPACE" bar doesn't work
Posted: Tue Jun 19, 2012 9:09 am
by airsoftsoftwair
djrikki wrote: Shame TAB and SPACE keys don't just work as documented as it tooks me ages to discover the real solution!
Where is it documented that Hollywood returns "TAB" and "SPACE" for these keys?
There's a rationale behind the behaviour. The idea is that you can do things like this:
Code: Select all
Switch msg.action
Case "OnKeyDown":
Print(msg.key)
EndSwitch
If "SPACE" or "TAB" were returned, you'd have to filter the key and replace it with " " or " " respectively in order to get a correct Print() output. Otherwise it would look like this: "HelloSPACEWorldTABHowSPACEareTAByouSPACEtoday?" ... That's why Hollywood returns all keys that represent printable characters in a ready-to-use format.
Re: "SPACE" bar doesn't work
Posted: Thu Jun 21, 2012 9:39 pm
by Tuxedo
I "discovered" the " " simply doing
DebugPrint(msg.key)
simple and fast to get the needed thing
