"SPACE" bar doesn't work

Find quick help here to get you started with Hollywood
Post Reply
User avatar
Juan Carlos
Posts: 889
Joined: Mon Sep 06, 2010 1:02 pm

"SPACE" bar doesn't work

Post 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?
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: "SPACE" bar doesn't work

Post 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
User avatar
Juan Carlos
Posts: 889
Joined: Mon Sep 06, 2010 1:02 pm

Re: "SPACE" bar doesn't work

Post 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.
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: "SPACE" bar doesn't work

Post by airsoftsoftwair »

It's left as an exercise for the reader :)
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: "SPACE" bar doesn't work

Post by djrikki »

All joking aside, its not so amusing for TAB which you have to type:

Code: Select all

"        "
- 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!
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
djrikki
Posts: 682
Joined: Wed Apr 06, 2011 12:26 am

Re: "SPACE" bar doesn't work

Post 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?
Evolve - Rapid GUI Development tool for MUI Royale and RapaGUI
http://myevolve.wordpress.com
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: "SPACE" bar doesn't work

Post 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.
User avatar
Tuxedo
Posts: 345
Joined: Sun Feb 14, 2010 12:41 pm

Re: "SPACE" bar doesn't work

Post by Tuxedo »

I "discovered" the " " simply doing

DebugPrint(msg.key)

simple and fast to get the needed thing :)
Simone"Tuxedo"Monsignori, Perugia, ITALY.
Post Reply