(no subject)
Richmond Mathewson
richmondmathewson at gmail.com
Sun Apr 18 07:46:53 EDT 2010
On 18/04/2010 14:40, Klaus on-rev wrote:
> Bom dias Haroldo,
>
>> ...
>>
>> 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.
> you have a little error in your logic, that's why!
>
>> 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
> ## ELSE here means EVERYTHING but "right"!
> ## Therefore every arrowkey but "right" goes to the next card!
>
>> 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
> Use this instead:
>
>
> on arrowkey tKey
> switch tKey
> case "right"
> if the optionKey is down then
> go first card of next bg
> else
> go next card of this bg
> end if
> break
> case "left"
> if the optionKey is down then
> go last card of previous bg
> else
> go previous card of this bg
> end if
> break
>
> # Now let all other arrowkeys pass
> default
> pass arrowkey
> break
> end switch
> end arrowkey
>
> I tend to use "switch" since this makes scripts better readable than lots of
> nested "if... then" statements.
>
>> Any help would be appreciated. Thank you.
>> Harold
> Best
>
> Klaus
>
seems unnecessarily long . . . :)
More information about the use-livecode
mailing list