Problems placed grouped groups

Robert Brenstein rjb at robelko.com
Tue Mar 15 17:29:39 EST 2005


>  >
>>  Ken, aren't you thinking of normal groups? Isn't it normally the
>>  other way around that background (bg group) gets messages after the
>>  card? Wouldn't it follow that in both cases the sub-background should
>>  get them all? But then should it get them also when message was sent
>>  to another background?
>
>Good question. So I tested this and here's what I discovered...
>
>I make a standard button called "Round", grouped it into a group called
>"Embedded", then created another button (a square one) called "Square", and
>then grouped the "Embedded" group along with the "Square" button and called
>it "Main". I then placed another button called "Outsider" just sitting on
>the card, not inside a group. I then inserted mouseUp scripts in all the
>objects to identify themselves and pass the message along. So the structure
>is like this:
>
>Stack
>   Card
>     Button "Outsider"
>     Group "Main"
>       Button "Square"
>       Group "Embedded"
>         Button "Round"
>
>OK. Here's how it goes with backgroundBehavior of both groups turned OFF,
>clicking on each of the buttons:
>
>    Round -> Embedded -> Main -> Card -> Stack
>    Square -> Main -> Card -> Stack
>    Outsider -> Card -> Stack
>
>I then turned on backgroundBehavior for group "Main", but left it off for
>group "Embedded". Here's the results (* = backgroundBehavior is ON):
>
>    Round -> Embedded -> Main* -> Card -> Stack
>    Square -> Main* -> Card -> Stack
>    Outsider -> Card -> Main* -> Stack
>
>I then turned it OFF for "Main", and ON for "Embedded":
>
>    Round -> Embedded* -> Main -> Card -> Stack
>    Square -> Main -> Card -> Stack
>    Outsider -> Card -> Stack
>
>Finally, I turned it ON for both groups:
>
>    Round -> Embedded* -> Main* -> Card -> Stack
>    Square -> Main* -> Card -> Stack
>    Outsider -> Card -> Main* -> Stack
>
>>From this, it seems we have the following rules:
>
>1) If a "background" group is contained inside of a group that is *not* a
>background, its backgroundBehavior is ignored for the purposes of message
>passing.
>
>2) A background group will only receive a message once, regardless of
>whether its backgroundbehavior is ON or not. So we have this:
>
>   Round -> Embedded -> Main* -> Card -> Stack
>
>and NOT this:
>
>   Round -> Embedded -> Main* -> Card -> Main* -> Stack
>
>3) A corrolary to #2: Background behavior only counts for objects that are
>not *inside* the background group; in my example it only affected the
>Outsider button and the Card itself (if I clicked on the Card with the Main
>group as background, I got "Card -> Main* -> Stack").
>
>
>I don't know about you, but I've learned a lot about background behavior
>today...
>
>:-)
>
>Ken Ray
>Sons of Thunder Software
>Web site: http://www.sonsothunder.com/
>Email: kray at sonsothunder.com


Thanks for reporting this, Ken. Educational indeed and excellent 
reference material. May be Richard could include it in part 2 
(advanced aspects of message passing?) of his message passing 
tutorial.

Robert


More information about the use-livecode mailing list