Page 1 of 1

How do populate object into Tab Panel

Posted: Fri Jun 19, 2009 8:31 pm
by Daross
Hi all,

I have to create a tab panel with 3 tab (Tab1, Tab2, Tab3.) and each table must have fields buttons etc.

I have tried to add the objects but do not remain in the individual tables

how Do add a object into single tab panel?


Thanks in advance

Posted: Fri Jun 19, 2009 8:58 pm
by FourthWorld
A tab control in Rev is a single object, and is not a container of other objects.

But cards and groups are containers, so you can either put the controls for each tab on separate cards after placing the tab into a group that's shared across all the cards, or put the controls into group and just swap the visibility of groups from the tab.

I tend to go the group route myself, in which I make a group for each tab using the name of that tab, and a script in the tab control something like this:

Code: Select all

on menuPick pItem
  repeat for each item tTab in "Tab 1,Tab 2,Tab 3" -- tab names
     set the vis of grp tTab to (tTab = pItem)
  end repeat
end menuPick

Posted: Sun Jun 21, 2009 10:47 am
by Daross
Hi Richard,

Now I understand the functions of the Tab Panel.

Thanks.

Posted: Mon Jun 22, 2009 10:09 am
by Klaus
HI Daross,

TABBED buttons receive 2 (two) parameters with the "menupick" message:
1. the item chosen
2. the item that has been previously chosen!

So you could also script:

Code: Select all

on menuPick tNew,tOld 
   show grp tNew
   hide grp tOld
end menuPick
Best

Klaus

Posted: Sat Jun 27, 2009 10:15 am
by Daross
Hi Klaus,

I have seen and tried your script on the topic "Controls" to link:

http://support.runrev.com/scriptingconferences/

The link scripting conferences are a gold mine for us beginners and the 'learning is faster.

Posted: Sat Jun 27, 2009 11:22 am
by Klaus
Buongiorno Daross,

yes, that's true and I cannot understadnd why this is not visible on the startpage of RunRev.

In fact one has to explicitely serach for it, which is almost impossible if you do not know what to search for.

Anyway have a nice weekend :-)


Best

Klaus

Posted: Sat Jun 27, 2009 5:36 pm
by FourthWorld
Klaus, there is an attractive simplicity to your method, and if one has a very large number of tabs might even yield a performance benefit.

But the reason I settled on my more "brute force" method is with the aim of defensive programming: groups' visibility may be affected by many things, whether other scripts in my app or other tools in the IDE, and walking through each group related to the tabs ensures that all groups are in their expected state.

In this case the stylistic difference is minimal, and I see no harm in doing it either way. But as a general rule, in recent years I find myself adopting ever more defensive programming practices, even at the cost of a few clock cycles per click, to help reduce the range of things that can go wrong somewhere else down the road.

Posted: Sun Jun 28, 2009 11:18 am
by Klaus
Hi Richard,

I only wanted to show Daroos the "official MetaCard way" so knows at least two ways of dealing with tabbed buttons :-D

Your solution is really nice and I think I will adopt it, since I am a big fan of Monsieur Boole anyway ;-)


Best

Klaus

Re: How do populate object into Tab Panel

Posted: Wed Dec 18, 2013 10:39 pm
by LC4iOS
Just sharing ....

More tabs than grouped controls.

Code: Select all

on menupick new, old
   ## new = Name of the chosen menu/tab
   ## old = name of the previously chosen menu/tab
   
   Try
      hide grp old
   Catch lErr
   end try
   
   Try
      show grp new
   Catch lErr
   end try
   
   ## That's all we have to script :-)
   
   ## Remember that the message will look like:
   ## menupick "One","Two"
   ## So this script is quite comprehensible...
end menu pick