Best Practice: Prevent Substacks from Triggering Main Stack Scripts

Richard Gaskin ambassador at fourthworld.com
Fri Feb 6 18:17:28 EST 2015


Brahmanathaswami wrote:

> "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

If the mainstack is a single card, just put the handler in the card script.

If the mainstack has multiple cards, put the handler in a common group 
script.

If neither of those are viable in your setup, you could add a check to 
make sure the long name of "me" is in the long ID of the target.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list