openStack called from subStack - why ?
Rolf Kocherhans
rolf.kocherhans at id.uzh.ch
Fri Apr 20 08:04:35 EDT 2012
Hello Jacques
Thanks for your answer - but….
I know about the message path and that handlers in the main stack can be used by
all of it's substacks, I used this feature myself for many years !
What puzzles me is that an openStack handler in the mainStack gets executed when
a substack (containing NO CODE at all) is opened ?
Till today I was thinking openStack handlers are a per stack thing only.
I am still confused abut this :-)
Cheers
Rolf
> 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
More information about the use-livecode
mailing list