path of a 'closeStackRequest'

Klaus Major klausimausi at mac.com
Thu Jan 16 09:34:01 EST 2003


Hi graham,

> I must be doing something really dumb, but I don't understand what. In 
> the app I'm developing (Revo 1.1.1 on MacOS 9.2.2), I have a mainstack 
> and a number of substacks. I appear to be getting more than one 
> 'preOpenStack' message to my main stack, which since my intention is 
> only to open it once during the whole life of my app, is causing me 
> considerable bother.
>
> In the absence of a path-tracing feature in the debugger, I therefore 
> put this handler into my mainstack:
>
> on closeStackRequest
>   answer (the short name of the target)&&"is trying to close the 
> Anchor stack"
>   pass closeStackRequest
> end closeStackRequest
>
> and went back to testing. I found that when I closed a substack by 
> clicking on its close box, the handler in the mainstack got called, 
> with the target being the first card of the substack. There is no 
> stack script in the substack. What's going on? It looks as if the 
> 'closeStackRequest' for the substack has got into the message path for 
> the mainstack and is being applied to the mainstack, but why? If I 
> want to allow closing of some substacks, either by scripting or by my 
> user without affecting the mainstack, what do I do?
>
> All explanations gratefully received, and as usual any pointers to 
> existing documentation on the subject (I am more than happy to read up 
> on this stuff, but I am often puzzled as to where to look).
>
> TIA
>
> Graham

i have no idea if and where this is documented...

But from (some really unhealthy) experience i can supply a solution.

Put a "closestackrequest"-handler into every substack

on closestackrequest
   close this stack
end closestackrequest


All handlers that are not defined in a substack are being
passed to its mainstack.

openstack
preopenstack
opencard
...
scrollbardrag
...
etc...

(Supposed they are defined in the stackscript of the mainstack)

This definitively has its advantages, but like in your case
some disadvantages...

But once you know the "name of the beast"... :-)

Hope that helps.


Regards

Klaus Major
klausimausi at mac.com




More information about the use-livecode mailing list