groups and background

Geoff Canyon gcanyon at inspiredlogic.com
Sat Dec 28 06:25:01 EST 2002


Setting aside issues of message passing for a moment, the issue below 
is fairly straightforward.

First, forget about the backgroundBehavior property. It has nothing to 
do with the use of the terms "background" and "group"

Instead, the distinction is this: "background" and "group" refer to the 
exact same thing -- a set of controls (possibly other groups as well) 
that have been grouped -- but in different contexts.

"group" refers to it in relation to a card. A group is always 
referenced in relation to the card it is on. Group 1 of this card is 
perfectly fine, background 1 of this card is not and will generate an 
error: Chunk: bad chunk order (must be small to large)

"background" refers to it in relation to a stack. A background is 
always referenced in relation to the stack that contains it. You can 
reference a group in relation to a stack, but you are really 
referencing it in relation to the current card of the stack. For 
example, if the group/background in question isn't on the current card, 
the reference will fail. This is why you need to use

place background "whatever" onto this card

rather than

place group "whatever" onto this cd

Finally, because I haven't been confusing enough, note that backgrounds 
are referenced relative to the order they are created, groups in their 
layering order on the card. If you have two group/backgrounds in a 
stack: "a" and "b" and you created "a" first, then if you create a new 
card and place "b" onto the card and then place "a" onto the card, the 
name of background 1 will be group "a" and the name of group 1 will be 
group "b"

Just realized I haven't answered the actual question. The number of 
backgrounds on both cards is 2 because it's relative to the stack: the 
number of backgrounds is _always_ the same across all the cards of a 
stack. It's 2 rather than 3 because groups that are nested in other 
groups don't count as backgrounds. The number of groups on card 1 is 3 
because all three groups are on that card. The number of groups on card 
2 is 1 because there is only one group -- c -- placed on it.

Hope this helps.


On Friday, December 27, 2002, at 10:50 AM, Dar Scott wrote:

> I have a stack with two cards.  Card one has three groups a, b and c.  
> Group a is nested in group b.  Group c has background behavior.  Card 
> two has c placed on it.
>
> Results from number of:
>
>                  Card 1         Card 2
> groups             3              1
> backgrounds        2              2
>

regards,

Geoff Canyon
gcanyon at inspiredlogic.com




More information about the use-livecode mailing list