tabbed buttons

Ken Ray kray at sonsothunder.com
Sat Jan 11 13:34:00 EST 2003


Jeremy,

You have two options: the "each tab is a card" option (i.e. if you have a
tabbed button that has 3 tabs, each click on a tab goes to a specific card),
or the "show/hide groups based on tab selection" option (one card with
multiple groups of controls, and you show a specific group when a tab is
selected.

For the "each tab is a card" option, you need to first group your tab
button, set its backgroundBehavior property to true, and then create one
card for each tab, and give the card the *exact same name* as the tab it
corresponds to. As you create cards, you should see the tab button appear on
each newly created card. Then the only things left to do are to script the
tab button and make sure the tab is reset on openCard. Here's the tab button
script:

on menuPick newTab,oldTab
  go card newTab
end menuPick

Then, to make sure that when the stack opens, the tab is marked properly
with:

on preOpenStack
  set the menuHistory of btn "tabset" to 1
end preOpenStack

For the "show/hide groups based on tab selection" option, you don't need to
group the tab button or set its backgroundbehavior since you're staying on
the same card. So you just layout your controls that you want for each tab,
and then group them, so you have one group per tab. Name the groups the
*exact same name* as the tab it corresponds to. Then, script the tab button
as follows:

on menuPick newTab,oldTab
  hide group oldTab
  show group newTab
end menuPick

And here's the initialization script for the stack:

on preOpenStack
  set the menuHistory of btn "tabset" to 1
  repeat with x = 2 to the number of lines of (btn "tabset")
    hide group (line x of btn "tabset")
  end repeat
  show group (line 1 of btn "tabset")
end preOpenStack


Hope this helps,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/

----- Original Message -----
From: "Jeremy Rayment" <jeremy at bigbackcomics.com>
To: <use-revolution at lists.runrev.com>
Sent: Saturday, January 11, 2003 12:03 PM
Subject: tabbed buttons


Hello everyone!

My name is Jeremy Rayment and I am new media developer in Ontario, Canada. I
stubbled accross Revolution while finding alternatives to Director.  I own
6.5 and am unhappy with Macromedia's pricing policy.  Anyway I am amazed
thus far with Revolution (the starter kit but will probably move up to the
small business version once I figure out the particulars of my database.)
and I hope to pick the brains of others who use revolution.

I am designing an application (sort of like a word processor only specific
to a certain writing style), and I like the tabbed button concept for part
of my interface design.

How do they work?  I can draw one out on the card, and set some properties,
but how do you distinguish from tab 1, to tab 2, to tab 3 interms of laying
out options and buttons specific to each tab? I run in browse mode and the
buttons just work..i.e. it seems to jump from one tab to another, but how do
you set specific buttons, text fields, etc for each tab whilest in authoring
mode?

Thanks in advance for your help.
Jeremy Rayment




More information about the use-livecode mailing list