Very simple tab button script

John Ridge ridge11103 at btinternet.com
Wed Jun 1 10:33:21 EDT 2005


Thanks to all contributors for this very helpful tutorial - I've learnt a
lot by working through the ideas, and playing with the different types of
menu button.

Could I suggest, Tom, that it might be an idea to add an opencard handler
that simply sets the menuHistory of the tab menu to (the number of this
card)? Then if the user naughtily uses some other method of going from card
to card, the tabs will still be correctly highlighted to reflect his current
location in the stack.
-- 


From: Robert Brenstein <rjb at robelko.com>
Reply-To: How to use Revolution <use-revolution at lists.runrev.com>
Date: Tue, 31 May 2005 14:38:06 +0200
To: tominjapan at excite.com, How to use Revolution
<use-revolution at lists.runrev.com>
Subject: Re: Very simple tab button script


>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