ArrowKey Handler problem
Richmond Mathewson
richmondmathewson at gmail.com
Sun Apr 18 12:17:41 EDT 2010
On 18/04/2010 16:11, Haroldo Mauro Jr. wrote:
> At 14:44 +0300 18/04/10, Richmond Mathewson wrote:
>> On 18/04/2010 14:29, Haroldo Mauro Jr. wrote:
>>> Hi everybody, I just joined this list. I used Hypercard for many years, since I got my first Mac in 1991. Then, some years ago swiched to Supercard, which I've been using a lot. I've had Revolution Studio for over a year but only now am trying to use it more steadly. So, here's what I need help with right now.
>>> In a converted Hypercard stack, an arrowKey handler in the stack script is not behaving as expected. So I checked the Revolution dictionary and found this example below, which I tested on my stack and it didn't work, just the same:
>>>
>>> (example from Rev dictionary)
>>> on arrowKey theKey -- make Up arrow go to the first card
>>> if theKey is "up" then go to card 1
>>> else pass arrowKey
>>> end arrowKey
>> Just tried that script: NO; doesnt work: documentation is misleading.
>>> Instead of going to card 1 it kept going to the next card each time I pressed the up arrow key, and after the last card the stack just closed.
>>>
>>> Here's my original handler, from the Hypercard stack script, which doens't work:
>>> (handler is in stack script)
>>> on arrowKey whichKey
>>> if whichKey is "right" then
>>> if the optionKey is down then
>>> go first card of next bg
>>> else
>>> go next card of this bg
>>> end if
>>> end if
>>> if whichKey is "left" then
>>> if the optionKey is down then
>>> go last card of previous bg
>>> else
>>> go previous card of this bg
>>> end if
>>> end if
>>> end arrowKey
>>>
>>> Any help would be appreciated. Thank you.
>>> Harold
>> My experience favours rawKeyDown:
>>
>> on rawKeyDown RAWK
>> if RAWK is 65363 then go to card 1
>> else pass rawKeyDown
>> end rawKeyDown
>
> Thank you Richmond. Something very weird happened when I tested your script. It made for an erratic navigation. I was on card 60 when I pressed the up key, and these are the cards that showed with each consecutive press of the up arrow: 59, 58, 58 again, 59, 60, 61, 60, 59, 58, 59, 59 again, 58, 57, 56, 57, 58, 65, 64, 63, 62, etc...
>
> I tested both your script and mine in a different stack. Same results.
>
> Haroldo
>
>
Give your first card a name, such as "cFIRST"
then, instead of
go card 1 try
go card "cFIRST"
are you putting the script in the stack or the card? should be in the
stack.
More information about the use-livecode
mailing list