Behavior Nightmare

David Bovill david.bovill at gmail.com
Fri Feb 12 07:32:03 EST 2010


Been using behaviors for a while now - and they have seemed unproblematic
and intuitive to me. I may well have missed something as I use them in a
particular way, but this is as far as i know the situation (shoot me down if
I get something wrong).

Behaviors are effectively backscript for the object they are attached to -
so a behavior on a group will be called before a card unless the group is a
background in which case it will be called after the card?


On 12 February 2010 11:04, Scott Rossi <scott at tactilemedia.com> wrote:

> Does anyone know what the message order is for behaviors assigned to
> multiple objects?
>
> I have a set behaviors assigned to a card, and a set of behaviors assigned
> to a group that is placed on the same card.  It seems that the behavior
> scripts of card are being handled *before* the behavior scripts of the
> group.  Is this expected behavior?  Is there some way I can have the
> scripts
> of group processed before those of the card?
>
> I've been trying to migrate a bunch of object/card/stack scripts to
> behaviors and it has been a major pain trying to get messages to naturally
> "fall" between objects the same way messages work in the normal message
> hierarchy.  I can't use a single set of behaviors for all the objects
> because there are common mouse event messages that need to be handled
> across
> objects depending on what object is clicked (ie mouseDown on the group does
> something different than mouseDown on the card).
>

Some thoughts:

   - a group behavior would be triggered before the card script unless
   background behavior is true
   - mouse events wont be sent to a group even if opaque unless an actual
   control is clicked on
   - card scripts can intercept and over-ride local group behaviors by using
   dispatch or checking for card properties
   - use as many groups as you want to nest behaviors



More information about the use-livecode mailing list