More specifically: close a stack, and the "closeStack" message is sent first to 
the current card of the closing stack. When you close a substack, if there is 
no closestack handler in the card script then the message is passed up the 
message path, and the next station on the path is the substack stack script. If 
there is a closestack handler there, it will get triggered. If not, it will be 
passed along, first to the mainstack stack script, then to any backscripts and 
stacksinuse, and if nothing handles it, the message goes to the engine and gets 
flushed. Putting a closestack handler for a mainstack into the card script is 
the easiest way to handle closestack routines when they are specific to closing 
the mainstack, since closestack messages sent up the message path don't go to 
the mainstack *card* script.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig

On Apr 20, 2012, at 4:27 AM, Jacques Hausser wrote:

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


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to