my arrowKey handler is working

Haroldo Mauro Jr. hmauro at hmauro.com
Sun Apr 18 18:33:03 EDT 2010


At 12:47 -0500 18/04/10, J. Landman Gay wrote:
>Hi Haroldo, how nice to see you here!
>
>>(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
>>
>>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.
>
>This is the default behavior for arrowkeys. If you have navigationarrows set to true (which you said you do) then the up and down arrows basically do a "go back" or a "go forth". When the stack closed, it was likely popping to another stack to go to a card there, which you had probably visited recently.
>
>Since you are getting the default arrow behavior instead of the scripted one, that tells me that your arrowkey message isn't reaching your handler for some reason. My first thought was that you might be using a card group instead of a background group (and as an HC convert, that's something you'll want to read up on,) but since it's an HC import that's unlikely unless you've added some groups since you imported the stack.
>
>Because the script works in a new stack, you're right it's probably something in that particular stack. I agree that you should probably set the hcBehavior of the stack to false; you don't need that in Rev and it may clear up some issues. You can still continue to refer to bgs and controls the way you are used to, though you'll probably change that later as you get used to Rev.
>
>About the advice to separate the data from the interface -- it's good advice. Rev isn't meant to use cards as a database. But to be honest, I wouldn't worry about that for now. If you have under 5,000 cards in the stack it will work just as it does in HC and I'd keep that structure until you've learned a little more about Rev. One thing at a time. If this stack is just for your own use, you may not want to change its database structure at all. I still use a number of old HC stacks in Rev that keep databases -- for example, I have an address book stack with one record per person and it works just fine. I don't even know 5,000 people. :)
>
>If you can't isolate the arrowkey problem, feel free to upload the stack somewhere and post a link to the list. You'll probably get a lot of solutions once we can see the scripts.

Hi Jacqueline, it's nice to be here learning Revolution. Thank you for the long answer and the suggestions. This stack is for my own use. It's a book catalog for my private library. I've working on it for several years in Hypercard. It has aproximately 1500 cards, four backgrounds. It not only holds the book data, but also has a couple of cards with Dewey Decimal Classification class codes, a list of authors and an A to Z table with cutter numbers, so it also assigns cutter numbers for the authors, via scripts, etc. There are a lot of scripts, and there are many adjustments to make before it will work 100 percent in Revolution.

Anyway, I commented out the whole stack script leaving only the arrowKey handler and it worked. Now I'll try to figure out where the problem is. But I have another question.

In the script, shift+right arrow moves to card 1 of next bg, shift+left arrow goes to last card of previous bg. This works now, but stops when it gets to the fourth bg either way. Is there a way to make it keep going, as in a loop, repeating the cycle, 1,2,3,4,1,2,3,4...etc?


Harold



















More information about the use-livecode mailing list