openStack called from subStack - why ?

Jacques Hausser jacques.hausser at unil.ch
Fri Apr 20 04:27:54 EDT 2012


Hi Rolf,
Seems straightforward for me: every message handler in the main stack's script is available to every substack and their cards… that's the ground of the message path!
Jacques

Le 20 avr. 2012 à 10:15, Rolf Kocherhans a écrit :

> 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
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode






More information about the use-livecode mailing list