Script Only Stack Behaviors and Nesting

Sannyasin Brahmanathaswami brahma at hindu.org
Tue Jul 3 20:33:40 EDT 2018


Just a side note, that for "parent" behaviors which have been "nested" as the behavior of multiple "children" ... we are "blinded sided" to this, as the designation is in the first comment of the script with doesn't appear in the IDE, SE

The only other place to see it is in the PB in 9+, that is obscure and is shows a "dot" nothing more.

If you are using text editor, no problem. But I have taken a convention for every child behavior, to make the first comment on the script declare:

-> ## this script has a parent: behavior_ListenUI  

So I can see it in IDE script editor

Coming to the "script local" problem. Jacque was misquoted. She  said scripts that are not attached to an object (there is no "this me"....) globals are required.

One solution is to use a single global as an array..

Global sConfigA # with keys needed

This doesn’t solve the problem of "who set that value" when tracing; but I found it convenient to have a single global to check out at any point this I want to use it. And the keys are like "custom properties" of global array.

 Still, if could lead to "untraceable" code if I  used that one array for too much.

Would be nice to solve it somehow. I found myself using  a "setter" command  from  parent script creating a child local script local.  And then a function to called that back...into parent.  Then a few days, later, thinking 

"I need that local value in this other child..... geez - this backwards! Parent has to check "down the message path"?....The parent script wants to have everything!  UhOH! I'm on the edge of snake pit here. Maybe I should not go down that road?"

So I put plans for all the cool stuff I could do in "parent script" (of other children which actually have object) aside for now.  Mostly use for UI stuff, like keep a mouseup handler, and if wanted it called from the child, just pass it in the child

On mouseUp
  pass mouseUp 
# goes to parent behavior_ListenUI
# because it has to have an object in the UI
# it will *not* be passed in the message path...unless you do this. 
End mouseup

BR

"I too am still trying to figure it out"

 Bob Sneidar wrote:

    I'm getting heavily into behaviors and script only stacks now (in preparation for Levure Framework) because my project has become complex enough to make it almost inevitable. I have perhaps 20 or so substacks in a mainstack. 



More information about the use-livecode mailing list