keyDown not responding

Discussion about LiveCode Global Jam events and activities

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Locked
mcgrath3
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 149
Joined: Thu Feb 23, 2006 8:49 pm
Location: Bethel Park, Pittsbrugh, Pennsylvania USA
Contact:

keyDown not responding

Post by mcgrath3 » Fri May 23, 2014 1:41 pm

This does not work in a new stack.

Code: Select all

on keyDown pKey
     answer pKey
     pass keyDown
end keyDown
Tom
Tom McGrath III
Lazy River Software
3mcgrath@comcast.net

hanson
Livecode Staff Member
Livecode Staff Member
Posts: 44
Joined: Thu Jun 16, 2011 9:55 am

Re: keyDown not responding

Post by hanson » Fri May 23, 2014 1:51 pm

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

mcgrath3
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 149
Joined: Thu Feb 23, 2006 8:49 pm
Location: Bethel Park, Pittsbrugh, Pennsylvania USA
Contact:

Re: keyDown not responding

Post by mcgrath3 » Fri May 23, 2014 2:07 pm

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
Last edited by mcgrath3 on Fri May 23, 2014 2:33 pm, edited 1 time in total.
Tom McGrath III
Lazy River Software
3mcgrath@comcast.net

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: keyDown not responding

Post by LCNeil » Fri May 23, 2014 2:14 pm

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

mcgrath3
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 149
Joined: Thu Feb 23, 2006 8:49 pm
Location: Bethel Park, Pittsbrugh, Pennsylvania USA
Contact:

Re: keyDown not responding

Post by mcgrath3 » Fri May 23, 2014 2:38 pm

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
Tom McGrath III
Lazy River Software
3mcgrath@comcast.net

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: keyDown not responding

Post by [-hh] » Fri May 23, 2014 2:57 pm

..........
Last edited by [-hh] on Wed Aug 13, 2014 2:55 pm, edited 1 time in total.
shiftLock happens

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: keyDown not responding

Post by LCNeil » Fri May 23, 2014 3:05 pm

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

-----

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: keyDown not responding

Post by sturgis » Fri May 23, 2014 7:37 pm

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.

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: keyDown not responding

Post by PaulDaMacMan » Sat May 24, 2014 6:37 am

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.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Locked

Return to “LiveCode Global Jam”