"Cascading" Object-Behaviors

Sannyasin Brahmanathaswami brahma at hindu.org
Mon Jul 31 00:52:29 CEST 2017

Yes, better to leave in place..  i.e. behavior buttons with no scripts, now assigned behavior to external file.

We are using a JSON file on disk that we read in to set the stack files on start up, because with a team, things get crazy if you have this in the binary.

One Caveat 

the PB does not show that  objects with the assigned behavior to a button with no script… has any code … it shows 
 0 lines of code, when in fact the behavior assigned to the button which is assigned to that object *is*  in the msg path.

Other caveats: I am getting "bitten" by ambiguity of "me"  in scripts.  but that is a different subject.   for mobile, timin is everything and we are frequently needing to allow 200 milliseconds, 500 etc before calling some other handler, while the UI gets updated. So typically the events we want to fire are in the same "library" but you can do 

Send to me  

you have to declare "this stack" to "stack "suchAndSuch" (which is the actual name of the file with these handlers) 

Svasti Astu, Be Well 



On 7/30/17, 10:28 AM, "use-livecode on behalf of Monte Goulding via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:

    >On 31 Jul 2017, at 3:50 am, Sannyasin Brahmanathaswami via use-livecode <use-livecode at lists.runrev.com> wrote:
    >"Entralled with external scripts and GIT are We" says Yoda
    I have implemented a scriptifier utility script if you are interested here https://github.com/livecode/livecode/pull/5600<https://github.com/livecode/livecode/pull/5600>
    It parses all objects in a stack looking for non-trivial scripts then generates a unique name based on object hierarchy and saves the script only stacks in a folder with the same name as the stack filename and sets the stackFiles appropriately. We have used it on some stacks in the IDE (the installer and the IDE startup stack) and have only found one side effect so far in an old script that used idle. Idle is only sent to objects that implement it and is not detected in their behaviors. For simplicity the script ignores any objects that already have behaviors as if you want a behavior hierarchy of script only stacks you need to script that when they are loaded.
    >It this bad practice? Of course it is a trivial matter to make a direct assignment to the external file since it is in the stack files
    My scriptifier (being a bit dumb about such matters) would do something similar when it encounters an object that is a behavior button used elsewhere. The behavior button scriipt will be exported and the hierarchy will be established. We haven’t noticed any issues with this although it probably wouldn’t take long to tweak the scriptifier to delete the button and set the behavior directly that would impact resource resolution like finding icons so it’s better to leave it in place. Such things are better done manually if necessary.

More information about the use-livecode mailing list