Background groups

Devin Asay devin_asay at byu.edu
Fri Feb 8 14:49:03 EST 2013


Hi Pete!

On Feb 8, 2013, at 12:27 PM, Peter Haworth wrote:

> Trying to avoid any gotchas before embarking on some work involving
> background groups and there's precious little information about them.

This is how I introduce groups to my students. (Apologies if it's too basic. And I can see now that it is a bit dated, having been done before the shared group property was created.): 

http://livecode.byu.edu/groups/Groups.php
> 
> Are there characteristics of background groups other than the background
> behavior property property that must be consistent on whichever card they
> are on in order for them to behave as bg groups?  Layer/ID/ Name, for
> example?

Not sure exactly what you're asking, but setting the backgroundBehavior prop to true is all that is needed. You do have to be careful about what handlers your background group has in it, because they can be invoked by any control on the card, or the card itself, because bg groups come after the card in the message hierarchy.
> 
> Do background groups behave differently depending on whether their shared
> behavior property is true?

AFAIK when the backgroundBehavior property is true, the shared group property is true by default/definition.
> 
> If I copy and paste a bg group onto a card instead of using the place
> command, does it mess up it "backgroundness"?  If not, what's
> the purpose of the place command

You can copy and paste a bg group to a card and it will retain its backgroundBehavior setting. But it will create a new group in the stack, unrelated to the other group of the same name. It'll have a different ID. Use Place Group to make the group appear on your card.
> 
> If I delete a bg group from a card rather than use the remove command, does
> that in any way affect its instances on other cards?  If not, what's the
> purpose of the remove command?

If you delete a group from a stack it is deleted for all cards it was one. It's just gone, poof, joined the choir invisible. Remove Group takes the group off the card without deleting it from the stack. It is even possible to have a group in a stack that isn't showing on any card.
> 
> I notice that if I copy and paste a card with a bg group on it into a
> different stack, the bg group is still there and has its background
> property set.  If I then create a new card in this stack, the background
> group is on it.  Will it still behave like a background group linked to the
> background group in the original stack?

No.
> 
> Thanks for satisfying my curiosity!

Glad to help!

Devin

Devin Asay
Office of Digital Humanities
Brigham Young University





More information about the use-livecode mailing list