Best Practice: Prevent Substacks from Triggering Main Stack Scripts

Brahmanathaswami brahma at hindu.org
Fri Feb 6 18:03:53 EST 2015


"it depends"

got it... for me it's not about protecting anything..

it's about..eg.

on resizestack x,y

   set the rect of some grc to the rect of this card
# and other tricks here  relating to dynamic geometry changes...

end resize stack

This gets triggered by a substack that does not have those controlled.

How do you do this in real code

on resizestack x,y
  if this stack is not the stack that this handler resides in then
    do nothing
else
   set the rect of some grc to the rect of this card
# and other tricks here  relating to dynamic geometry changes...

   end if

end resizestack



Swasti Astu, Be Well!
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com



J. Landman Gay wrote:
>
> I usually do the thing where you put the open* handlers into the first 
> card of the mainstack. It's easiest.
>
> If there are handlers that should be shared, but only with a few 
> stacks, I put those handlers into the mainstack and check in the first 
> line of the handler to see if the target is one of the stacks it needs 
> to work with, and if not it exits.
>
> If almost everything needs to use the open* handlers except one or two 
> stacks, then I put the handlers into the mainstack stack script and 
> put blocking handlers into the stacks that are an exception.
>
> So I guess the answer is...it depends. 




More information about the use-livecode mailing list