Best Practice: Prevent Substacks from Triggering Main Stack Scripts

Scott Rossi scott at tactilemedia.com
Fri Feb 6 02:44:26 EST 2015


If you can do it, the easiest way is to place all your handlers in the card script of the first card of your main stack.  All the handlers will be triggered by the main stack, but not the substacks.

If you must place your handlers in the stack script, you can compare the name of the owner of the target at the beginning of each handler, something like:
"if the short name of the owner of the target <> the short name of me then exit resizeStack"

Otherwise, your method of placing blocking scripts in the substacks will work too, but the card script of card 1 of the main stack is really the easiest method.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design

> On Feb 5, 2015, at 10:49 PM, Brahmanathaswami <brahma at hindu.org> wrote:
> 
> If you put any preopenstack, resizestack, close stack etc. script in the mainstack script.. these will be triggered by the same action in a substack.
> 
> What is the best way to avoid this?
> 
> I just moved all those to the main background group of the main stack, but I'm not happy with that architecture. I'm so
> use to running most script in the main stack script for simplicity sake and ease of finding things.
> 
> I suppose one can install "dummy" handlers in the substacks to match.
> 
> e.g
> on preopenstack
> end preopenstack
> 
> and since you are not passing anything, I suspect it will prevent triggering that handler in the main stack..
> 
> But, what are you veterans doing to handle this?
> 
> Swasti Astu, Be Well!
> Brahmanathaswami
> 
> Kauai's Hindu Monastery
> www.HimalayanAcademy.com
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list