Page 1 of 1

keyDown not responding

Posted: Fri May 23, 2014 1:41 pm
by mcgrath3
This does not work in a new stack.

Code: Select all

on keyDown pKey
     answer pKey
     pass keyDown
end keyDown
Tom

Re: keyDown not responding

Posted: Fri May 23, 2014 1:51 pm
by hanson
Hi Tom,

can you please update us with the version of LiveCode this applies to and the platform/operating system you are using.


Kind Regards,

Hanson

Re: keyDown not responding

Posted: Fri May 23, 2014 2:07 pm
by mcgrath3
So sorry,

I was testing this on Mac OSX 10.9.2 with LiveCode 7.0 dp 4

So this seems to work in a "new" stack by itself but not in the stack I was testing.

I downloaded this tetris stack http://livecodegamedeveloper.com/blog/2 ... -tetris.lc from a thread on the use list and noticed that it was not working on my Mac OSX machine. So I put in a couple of answer commands but no luck. I then put in a rawKeyDown and got it to work using the arrow keys that way.


on arrowKey pKey
put pKey into sKeyPress
-- answer sKeyPress
pass arrowKey
end arrowKey

on keyDown pKey
if pKey = space then put "space" into sKeyPress
-- answer sKeyPress
pass keyDown
end keyDown





on rawKeyDown pKey
if pKey is 65361 then put "left" into sKeyPress
if pKey is 65363 then put "right" into sKeyPress
if pKey is 65362 then put "up" into sKeyPress
if pKey is 65364 then put "space" into sKeyPress
--answer pKey
end rawKeyDown


So after downloading this stack http://livecodegamedeveloper.com/blog/2 ... -tetris.lc can you use the arrow keys to get it to work?

Tom

Re: keyDown not responding

Posted: Fri May 23, 2014 2:14 pm
by LCNeil
Hi Tom,

I just tested this via LC DP4 on a MBP running 10.9.2 and the key is answering as expected. If possible, could you supply a sample stack (and even a short video showing this behaviour) as there could be something more underlying causing the issue


Kind Regards,


Neil Roger

RunRev Support Team ~ http://www.runrev.com

Re: keyDown not responding

Posted: Fri May 23, 2014 2:38 pm
by mcgrath3
This is the link I downloaded from and of course it is now working fine. I will keep looking into it.


http://livecodegamedeveloper.com/downlo ... s.livecode

Re: keyDown not responding

Posted: Fri May 23, 2014 2:57 pm
by [-hh]
..........

Re: keyDown not responding

Posted: Fri May 23, 2014 3:05 pm
by LCNeil
Hi Tom,

I've downloaded the stack and I am able to play the game on DP4 without needed to use rawKeyDown.

Have you tried the following on an empty stack. This replaces the answer dialog with output to the message box

Code: Select all

on keyDown pKey
     put pKey
     pass keyDown
end keyDown
It is worth noting that keyDown will not respond to certain specific keys. More specifically, Return, Tab, Backspace, Delete, or Enter key, an arrow key, or a function key. In instances where these are used, you must use the appropriate key messages or (e.g. for an arrow key it is arrowKey) or ,as you have mentioned, rawKeyDown messages.


Kind Regards,


Neil Roger

RunRev Support Team ~ http://www.runrev.com

-----

Re: keyDown not responding

Posted: Fri May 23, 2014 7:37 pm
by sturgis
is it possible you have a stray keydown handler somewhere that doesn't pass? Maybe in a frontscript or library?

The stack works fine for me, mac os, mavericks, dp 4

EDIT: See that its working for you now, but the question still applies. Still wonder if there was something in use or front/back scripted that had a keydown handler, keeping the one in the game script from firing.

Re: keyDown not responding

Posted: Sat May 24, 2014 6:37 am
by PaulDaMacMan
I had a stack recently that trapped the arrowkey msg in the script to scroll a DataGrid group that was acting strangely (on 6.6.2 & 6.7DP3 - MacOS X 10.6.8)
The arrowKey "down" would work fine but "up" would loose the focus from the grid after three "up"s
I also used the rawKeyDown instead to work around this problem. I believe the DataGrid Library uses RawKey messages which may have been some kind of conflict. I look and see if I have an old version I can post.