Simple Scoping Question

David Burgun dburgun at dsl.pipex.com
Wed Apr 20 15:33:26 EDT 2005


>Recently, David Burgun  wrote:
>
>>>  If your openStack handler is only supposed to apply to your main 
>>>stack, then
>>>  place the openStack handler in the script of the *first card* of your main
>>>  stack (this goes for any initialization handlers since they are only called
>>>  when the first card is opened).  Any subsequent opening/closing of stacks
>>>  will not trigger the init handler/s.
>
>>  Thanks a lot for this. No, I don't have any substacks so moving it
>>  into the card script sounds best. Ok a couple of questions of this.
>>  You say move it to the "first card", well in this stack there is only
>>  one card so the issue doesn't come out, but for the sake of knowing,
>>  if I have more than one card in the stack, do you mean the card that
>>  is currently the "first" card, or the first card created by the IDE?
>
>Literally, the first card of *your* main stack.
>
>In your case there is only one card but the method still applies: whenever
>you need to initialize stuff, placing the init scripts in the first card of
>your main stack limits causes the scripts to run only when the main stack is
>opened (preOpenStack, openStack, openCard, etc).  Subsequent opening/closing
>of substacks or IDE stacks will not trigger your card scripts because they
>are not part of the other stacks' message hierarchy.

Ok, I think I understand that, in this case though, the Stack in 
question *is* a main stack, does this make a difference?

The reason I asked is because I have some Stacks that have multiple 
cards formed into a Tabbed Button, one card for each tab, and on the 
stacks that have this control I send a menuPick command to the Tab to 
select the correct card. I was wondering if this would cause 
problems, seems not? Just add it to the fist card of the Stack.

Ok, I will give this a try and report back.

Thanks a lot for your help, you don't know how much I appreciate it. 
Some of this stuff is a complete mystery. The documentation seems so 
scattered that it's hard to know what is going on sometimes.

I guess it doesn't help that the IDE gets hosed so often when trying 
to setup this kind of stuff.

All the Best
Dave


More information about the use-livecode mailing list