Tab Menus

Jeanne A. E. DeVoto jeanne at runrev.com
Tue Oct 8 23:19:01 CDT 2002


At 6:36 PM -0700 10/8/2002, Bailey Kessing wrote:
>     I am a recent converter to Revolution from SuperCard so pardon my
>ignorance. I am trying to use the Tab menu to present various options to
>users. I feel completely stupid but after creating a tab menu on a card I
>am at a loss to figure out how to use it. I can t figure out how to use
>it either to  navigate  or show cards, info or what ever. I would
>greatly appreciate pointers.

The basic thing you need to do is write a menuPick handler in the tab
button's script. (The menuPick message is sent when the user clicks a tab,
or chooses an item from a menu.)

Usually, you create either a card for each tab, or a group for each tab,
and go to the appropriate card (or show the appropriate group) when its tab
is clicked. The card or group contains the buttons, fields, etc. for that
tab.

Here's an example using the first (card) method. It assumes that the stack
contains one card for each tab, with the name of each card being the same
as the name of a tab:

  on menuPick theTab -- goes in the tab button's script
    go card theTab -- name of the tab that was clicked
  end menuPick

One more tip: to show on each card, the tab has to be grouped and placed on
each of the cards. (Setting the group's backgroundBehavior property will
place it automatically when you create a new card - it's a little easier if
you're creating several cards with the same group(s).)

The script for the second (group) method is similar:

  on menuPick newTab, oldTab
    -- (we ignored the 2nd parameter above since we didn't need it)
    lock screen
    hide group oldTab -- name of the previously-selected tab
    show group newTab -- tab that was clicked
    unlock screen
  end menuPick

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - The Solution for Software Development
http://www.runrev.com/





More information about the use-livecode mailing list