Tabs

Robert Brenstein rjb at rz.uni-potsdam.de
Sun Jan 2 16:28:27 EST 2005


>  >From a long-time noob:
>
>You can do it using a single card.  You can then selectively hide/show the
>objects per tab pane using a mouseUp handler for the tabbed panel in which
>you check for the selectedText of the tab button.  From there, you can use
>either case statements or the if-then construct to display/hide the
>appropriate panel stuff.
>
>Something along the lines of:
>
>on mouseUp -- of the tabbed button set
>   if the selectedText of me is "Tab1" then --checks for active tab
>     hide image|field "myImageName"|"myFieldName" --hides unwanted stuff
>     show image|field "myImageName"|"myFieldName" --shows wanted stuff
>   end if
>   --... repeat until you've checked for all tabs
>end mouseUp
>
>At least, that's how I think I've done it in the past @;-)
>
>HTH,
>
>Judy

It is usually preferable to group all items associated with each tab, 
so when switching tabs, you just hide one group and show another. In 
other words, the script sample from Judy above is reduced to a single 
hide/show pair for each tab.

When there is a larger number of objects and/or special handling is 
required when showing, it is indeed better to use multiple cards as 
suggested in another post, with special handling tucked into 
preopencard handler, for example. Tab button should be a 
single-object group with background behavior.

A small correction for Judy: the handler should be menuPick not 
mouseUp. And menuPick gets the name of the selected tab as the 
parameter so no need to call the selectedText of me. On the other 
hand, it is usually convenient to track the currently showing tab 
using a custom property of the tab button.

Robert


More information about the use-livecode mailing list