openStack called from subStack - why ?

Rolf Kocherhans rolf.kocherhans at id.uzh.ch
Fri Apr 20 04:15:37 EDT 2012


After years of coding, today I discovered for the first time while debugging
that an openStack handler in a mainStack gets also called when a subStack
of it is opened !

I put this into the stackScript of the MainStack:

global varMainStackName
on openStack
   put the short name of this stack into varMainStackName
end openStack

In a button I display the variable varMainStackName:

global varMainStackName
on mouseUp
   answer varMainStackName
end mouseUp

When I now add a substack also containing the display button
it contains the name of the substack and not the name of
the mainStack !

I found in the docs that if I put the script onto the first card of
the mainStack instead of into the stackScript, it all works as expected !

But why ?
This confuses me totally !

I always had the (wrong!) impression that every openStack handler is
only called once, and also that it belongs to the stack containing it.

Can someone explain why this is not so !

Cheers
Rolf




More information about the use-livecode mailing list