Very simple tab button script

Robert Brenstein rjb at robelko.com
Tue May 31 08:38:06 EDT 2005


>Well the beauty of it is that you don't have to name each card for the tab.
>1. make a tab button for your stack
>2. put in the background (so it appears on every card)
>3. put a line in the buttons contents for each card--you don't need 
>to name the card to match the tab!
>
>ex. (these are the lines in the buttons contents)
>Welcome -> line 1, so selecting this will go to cd 1
>How to use
>History
>Preferences -> line 4, so will go to cd 4
>
>Then you just have to make sure that your cards are in order.
>
>The (only?) advantage of this code over something like:
>on menuPick tWhich
>   go to card tWhich
>end menuPick

Personally, I prefer to keep the order of tabs independent from the 
order of cards, and syncing the tab label and card names is not that 
much work. Actually, keeping the card order when you get beyong a few 
cards (I have 14 tabs in one project right now) is becoming more of a 
burden than syncing names.

I just have an extra line in my handler so I am reminded if I haven't 
added a given card yet.

  on menuPick tWhich
    if there is not a cd tWhich then beep
    go cd tWhich
  end menuPick

If you insist on using card number so you don't bother with card 
names, you can still disassociate the orders if you use custom 
properties of the tab button to control which card corresponds to 
which tab.

  on menuPick tWhich
    go cd (the tWhich of me)
  end menuPick

or to play safer create a customProperty set

  on menuPick tWhich
    go cd (the myDestCard[tWhich] of me)
  end menuPick

Robert


More information about the use-livecode mailing list