living and learning (tabmenu template script inside!)
b.xavier at internet.lu
Mon Jan 17 15:30:47 EST 2005
Ken, tabview scripters...
Here's the actual XOS template which I use anyday and copypaste anywhere for
tabmenus (or index fields).
It's simplified but has combined examples to show you how much advantage you
can take of a tab menu (or an option/pulldown menu). This thing has a
local oldtab -- if this control is a menu then you want to remember which
view was last. You can also use a custom property or check that all view
groups are hidden in a loop which I'll skip writing for space off-topic
purposes - it was also shown in a recent mail quite elegantly...)
Imagine a tabmenu button with this script...
on menupick newtab, oldtab
if there is a group/card oldtab then
hide group/save card oldtab
else if there is a fld oldtabthen
if there is a grp/cd newtab then
show grp/go cd newtab
propose a new one !!! (smart apps do this dont they ;)
-- custom object routines go here
The ifs check top to bottom the card or group hierarchies - if no group,
then maybe a field or graphic or card... This way the script can be used
without modification anywhere.
I usually populate my menus before the choices or gui/views are designed in
the applications. With the option to create new cards or fields, for
example, this makes the design process automatic, when you choose it, it's
created if it didn't already exist!
If the tabmenu gets too long, consider using a side index field or a
pulldown menu instead. Tabs should be used for few items as possible (takes
longuer to read) but they are very practical to find something between 2 and
6 items across.
That's the first metacard trick I wrote! It's not just a template to help
write software faster (given), it's a phylosophy to help software write
(you can see many variations of this scripts in action in any of my stacks
at Monsieurx.com - the discrete browser has it a gogo! The options tabmen
has the index implementation.
To make tabviews in tabviews, the tabview button and all it's scripts should
be grouped together (with the tabview at the lowest layer). Then you can
paste that group into another group with a tabview below. Watch the naming
of the groups if you have many. Conflicts in naming can hide a group in a
hidden group and it seems your software doesn't run logically anymore!
Hey, thanks Ken for bringing this
opportunity to write a thought of XOS!
Seeing things in the ide's way is not
as good as seeing things the app way...
Only 41 minutes to write this! A record! ;)
> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com] On Behalf Of Ken Ray
> Sent: Monday, January 17, 2005 20:05
> To: Use Revolution List
> Subject: Re: living and learning
> On 1/17/05 1:01 PM, "Bob Hartley" <rev at armbase.com> wrote:
> > At 18:36 17/01/2005, you wrote:
> > Hi Guys
> > Hmm I know this is supposed to eb easy ut I cant get me
> head around
> > it. :-(
> >>> I never tought of sharing a tab and moving through
> cards.... I have
> >>> this app with 8 tabs and I am hiding and showing
> groups... silly me...
> >>> Thanks Richard, again, I learn a new trick from your mail!
> >> I do this all the time - create a tab button, group it, set the
> >> backgroundbehavior to true, then set its script to:
> >> on menuPick newTab,oldTab
> >> go card newTab
> >> end menuPick
> >> Easy!
> >> :-)
> > Do you have a quick 2-3 tab (2 fields/tab) example you
> could knock up
> > and put on revonline?
> > Once I see a simple example I could get into this.
> Sure..., sorry but I forgot one critical step: name the cards
> the same as the tabs.
> It's on revOnline under the user 'kray' called "Cheesy Tab Example".
> Ken Ray
> Sons of Thunder Software
> Web site: http://www.sonsothunder.com/
> Email: kray at sonsothunder.com
> use-revolution mailing list
> use-revolution at lists.runrev.com
More information about the Use-livecode