Tabs

Robert Brenstein rjb at rz.uni-potsdam.de
Mon Jan 3 07:05:31 EST 2005


>>Are there advantages of this approach compared to Dave C's suggestion of
>>
>>>on menuPick pNew, pOld
>>>   hide group pOld
>>>   show group pNew
>>>end menuPick
>>
>>
>>Now that I realize that there is a second parameter provided, it 
>>seems like the better way - but are there any cases where the 
>>"pOld" wouldn't be what might be expected ?
>
>I don't think it makes much difference, but the former may be a 
>better example of "defensive programming" as it accounts for the 
>possibility that some other script (or even the developer during 
>editing) may leave a group visible that isn't the same as pOld.
>
>--
>  Richard Gaskin
>  Fourth World Media Corporation

Richard's approach is more generic and can be used when some tabs 
show more than a single grp (it is plausible to have some group 
'shared' by a few tabs).

Furthermore, the pOld parameter is not always passed, although I 
think this happens only when changing cards (I never bothered to 
investigate the circumstances). This is why I mentioned using a 
custom property

on menuPick pNew
   if the showingTab of me is not empty then hide grp (the showingTab of me)
   show grp pNew -- or: go cd pNew
   set the showingTab of me to pNew
end menuPick

Preserving the visible grp name allows me also to sync the tab button 
correctly with the displayed grp when reopening the stack. This can 
be required when using multiple card approach.

Robert


More information about the use-livecode mailing list