question about mainStack scripts

Robert Brenstein rjb at robelko.com
Tue Aug 30 08:31:37 EDT 2005


>I have a problem with a preOpenCard handler in the stack script of 
>the main stack of a huge project, that I never had before.  I've 
>totally redone a ton of things in the last 3 days, but I didn't 
>think any of these changes would change  the general working of it , 
>yet something keeps cropping up that I haven't seen before don't 
>understand.  I have managed to fix it in almost every case but 2, 
>which are kind of important.  Maybe someone has the solution for me 
>;-)

Lars,

Your problem is caused by a feature of message passing: any message 
that is passed further from a substacks is sent to stack script of 
the mainstack.

If each of your substacks has its own preopencard handler, then just 
do not pass that message and the one in the mainstack won't get 
called. Another way to handle that is for the handler in the 
mainstack to check whether the defaultstack is the mainstack and do 
nothing if it is not. If the preopencard handler is not required to 
be in the stack script of the mainstack, you could move it to card 
level. Alternatively, you could have a preopencard handler on each 
card of the mainstack calling a custom-named handler on the stack 
level, like mainPreopencard, for example.

Robert




More information about the use-livecode mailing list