Script Editor & arrowKey handler issue - LiveCode 5.0.2

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
risu23GA5f74
Posts: 4
Joined: Wed Dec 21, 2011 10:42 am

Script Editor & arrowKey handler issue - LiveCode 5.0.2

Post by risu23GA5f74 » Wed Dec 21, 2011 11:46 pm

I have downloaded and installed LiveCode 5.0.2 on Windows 7 (64-bit).
I am following the first lesson from the Game Academy.
I create a new card, and add a rectangle. I open the Script Editor and enter the following:

on arrowKey pKey

I press the Enter key. I then see this:

card id 1002: compilation error at line 2 (Handler: bad command), char 1

"arrowKey" is never colored as it is in the Game Academy video, though "on" is bold indicating the IDE is reacting to what I have typed.

Help! What am I doing wrong? :-(

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Post by jmburnod » Thu Dec 22, 2011 12:03 am

Hi,

You must add "end arrokey" like that

Code: Select all

on arrowKey pKey
   put pKey -- show the dir of the arrowkey pressed into the messagebox
end arrowKey
Best regards

Jean-Marc
https://alternatic.ch

risu23GA5f74
Posts: 4
Joined: Wed Dec 21, 2011 10:42 am

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Post by risu23GA5f74 » Thu Dec 22, 2011 12:09 am

When I hit Enter to go to the next line, I get the compilation error and can't type anything in any longer.

Is there some way that one should move from one line to the next without pressing Enter? I tried Shift-Enter and that moved me to the next line, but the code I typed wasn't indented or syntax colored or anything.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Post by mwieder » Thu Dec 22, 2011 12:17 am

Does your keyboard have a Return key as well as an Enter key?

risu23GA5f74
Posts: 4
Joined: Wed Dec 21, 2011 10:42 am

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Post by risu23GA5f74 » Thu Dec 22, 2011 12:24 am

No, but I purchased the PC when I lived in Canada so it's in both English and French (I have a key for the Euro symbol, for instance). I will see if I can get a pure US keyboard config going....thanks for the clue!

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Post by mwieder » Thu Dec 22, 2011 12:29 am

I believe on Windows the Enter key on the numeric keypad compiles your script while the Enter key in the alpha part of the keyboard just enters a newline. I'm at a linux laptop at the moment so I can't vouch for that statement for sure.

risu23GA5f74
Posts: 4
Joined: Wed Dec 21, 2011 10:42 am

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Post by risu23GA5f74 » Thu Dec 22, 2011 12:45 am

I've tried both and they have the same effect - compile. There appears to be no single key on my keyboard that simply enters a newline.

Thanks for your feedback - at least I know that what I'm seeing is NOT expected behavior. I'll try to scrounge up a new machine and see if I can get it working.

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

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Post by sturgis » Fri Dec 23, 2011 4:23 am

For now try either shift-enter or alt-enter. Either should work.

Post Reply