backgroundBehavior

Typeproperty
DictionaryLCS
LibraryLiveCode Script
Syntax
set the backgroundBehavior of <group> to {true | false}
Synonymsbgbehavior
Associationsgroup
Summary

Specifies whether a group behaves as a background and come after it's card on the message path.

Introduced1.1
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Example
set the backgroundBehavior of group 1 to false
set the backgroundBehavior of the last group to true
if the backgroundBehavior of group "backgroundObjects" is true then
 -- do something
end if
Values
NameTypeDescription
Value

The backgroundBehavior of a group is true or false. By default, the backgroundBehavior property of newly created groups is set to false.

RelatedProperty: HCAddressing, sharedBehavior, backgroundNames, backgroundIDs, dynamicPaths
Message: preOpenBackground, openControl, openBackground, closeBackground, preOpenControl, closeControl
Command: place, send
Control Structure: pass
Description

Use the backgroundBehavior property to make groups behave like backgrounds and to automatically place groups on newly created cards.

Only top-level groups may be background groups; an attempt to set the backgroundBehavior of a nested group to true throws an error.

A background group differs from a normal group in the following ways:

  • The group's script is placed behind the card in the message path for any message not originating from a control within it.
  • The group can be referred to using the 'background' chunk.
  • The card on which the group is placed receives preOpenBackground / openBackground / closeBackground messages (these messages occur instead of preOpenControl / openControl / closeControl being sent to the group itself).
  • The group can be placed onto multiple cards.
  • If the group is placed on 'this card' at the time a new card is created, it is automatically placed onto the new (empty) card.

A background group is also a shared group. This means that when the backgroundBehavior is set to true, the sharedBehavior is also set to true (if it is not already).

Note: Setting the backgroundBehavior of a group to false does not affect the sharedBehavior property, in particular the latter is not be set to false until it is explicitly done so.

Note: Only groups whose backgroundBehavior is true appear in the list reported by the backgroundNames and backgroundIDs properties.

Note: If a stack created in a version of LiveCode earlier than 1.1 is opened in 1.1 or later, the backgroundBehavior of all its groups is set to true by default. This also applies to imported HyperCard stacks.

Tagsobjects