Chained Behaviors
Scott Rossi
scott at tactilemedia.com
Fri Jul 12 14:40:07 EDT 2013
In my case, I've been waiting years for something like chained behaviors.
I create a lot of custom controls, and the limit of a single behavior per
control was not enough.
At the control level, I use functions and commands are exclusive to a
single control. But at a higher level, I want a set of common
functions/commands that can be used by multiple controls, so I don't have
to maintain the same handlers in multiple behaviors.
Until now, the only way to get this work was using front/backScripts or a
library stack. But in all these cases the common functions/commands would
be available to every LiveCode object and could be called by accident or
potentially affect controls that weren't mine. Using chained behaviors
allows you to keep handlers localized to only the controls that use them.
I have built a system that uses one behavior for a wide range of controls
using switch statements, and the higher the number of controls you have to
support, the more complex and messier the code gets. Chained behaviors
gives you another option to modularize your code.
Regards,
Scott Rossi
Creative Director
Tactile Media, UX/UI Design
On 7/12/13 10:04 AM, "Peter Haworth" <pete at lcsql.com> wrote:
>Has anyone got any real world examples of the benefits of the new chained
>behaviors feature?
>
>I just read the latest newsletter article about them and while I
>understand
>the concept, I didn't see benefit in the example scenario over a single
>behavior with some common logic and a switch statement to handle the logic
>specific to each "sprite".
>
>
>Pete
>lcSQL Software <http://www.lcsql.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