preOpenStack, openStack in Card 1?? Rules conformation.
Jeanne A. E. DeVoto
revolution at jaedworks.com
Thu Mar 30 17:47:58 EST 2006
At 11:23 PM +0200 3/30/2006, Francis Nugent Dixon wrote:
>The doc clearly states "the destination card". As I often :
>
> "go to card "x" of (sub)stack "y"
>
>I assume this means "the openStack script in whatever card
>you FIRST go to in the stack" This could cause a problem if
>you have an "openstack" in a sub-stack .... !
It does cause problems, if the openStack handler in your main stack
assumes that the main stack is the current stack when openStack is
sent. In this case, when a substack is opened, the openStack message
is sent to the current card of the substack, then to the substack
itself, then to the main stack, so if the openStack message isn't
intercepted first, the main stack's openStack handler will run in
response to the substack opening.
There are three ways to avoid this:
1. Put the openStack handler in the main stack's first card, instead
of in the stack script. This prevents the problem, since when the
substack is opened, no message is sent to a card of the main stack -
only the stack itself is in the substack's message path.
2. Put an empty handler in the substack's script, to stop the
openStack message from going to the main stack:
on openStack -- in substack's script
end openStack
3. In the main stack's openStack handler, test which stack called it:
on openStack
if the owner of the target is not me then pass openStack
-- do stuff for main stack opening
end openStack
The target is a card, and the owner of the target is the stack that
was opened. If the owner of the target is not "me" (the main stack,
in this case), then this handler skips the rest of the instructions.
--
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com
More information about the use-livecode
mailing list