Some things about backgrounds i never knew

J. Landman Gay jacque at hyperactivesw.com
Thu Dec 30 16:24:41 EST 2010


On 12/30/10 5:13 AM, David Bovill wrote:
> What i did not get is that what is happening
> here is such a hack, that is there are two important concepts / behaviors of
> backgrounds:
>
>     1. It is shared across many cards and changing a property of one changes
>     the property of all ie they are the same object and have the smae id)
>     2. The message path is different
>
> These seem however not to be linked, or related directly to the various
> built in functions ie  backgroundbehavior / backgroundnames / backgroundids
> - so in the examples mentioned in previous posts you can have a background
> shared across serveral cards that has it' background behavior turned off and
> therefore does not show up in the backgroundnames / backgroundids. This is
> problematic in the handlers I am writing now - as I want to know whether to
> export the background or not, so I can;t rely on any of the built in
> functions.

You can place any group on a card, regardless of its backgroundBehavior. 
All of the background* functions return only those groups with 
backgroundBehavior set, whether or not the group is placed on the 
current card. It is unusual to assign a group backgroundBehavior and 
then turn it off again, but when you do that I believe the group's 
position in the message hierarchy will change and it will behave as a 
card group again. Because the group is placed on several cards, changes 
to it anywhere will reflect across all cards that contain the group. 
BackgroundBehavior doesn't affect whether changes populate across cards; 
if the ID matches, it's the same group.

You don't need to worry about backgroundBehavior when checking groups 
for export. Just get "the number of groups" or "the groupnames of this 
card" and export them all. Those that are shared across other cards will 
still be in the list regardless of their backgroundBehavior setting.

If instead you want to avoid exporting any background groups, then as 
you repeat through the list, check the group's backgroundBehavior and 
skip those where it's true.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the Use-livecode mailing list