Livecode Wiki
Advertisement

A group is a single object that holds one or more other objects. It can even contain another group. A group is the most versatile object in LiveCode.

Built-in Message handler[]

DevelopmentToolbar.jpg

You can create a group by selecting the card controls you want in the group, then clicking on the Select Group button in the IDE.

You can also create a group by using the group statement in your code. Suppose you have a field, an image and a graphic on the current card which you want to group together. For example:

group field "Help" and image "Help Icon" and graphic "Outline"
set the name of it to "myGroup"

The above statements will create a group containing a field, an image and a graphic and name it "myGroup".

If a group already exists, you can add controls to that group. For example:

create button "FatCat" in group "groupName"

Once you have created a group, you can change any of its properties. You can select, copy, move and resize the group. Groups can be any size, can be shown or hidden, and can be moved to any location in the stack window, just like any other control. Like other controls, groups can be layered in any order with the other controls on the card. Groups can also display a border around a set of objects.

The controls in the group maintain their own identities . You can add more controls to the group or delete them. The controls are owned by the group, which is owned by the card. The message paths go from the objects to the group to the card.

A group has its own script. The group is a good place to put the handler for the objects it contains.

In Edit Mode, when you click on one of the controls in a group, the whole group is selected. If you click on the menu Edit > Select Grouped Controls, then click on one of those controls, only that control is selected.

Background[]

In LiveCode you can change a group into a background by changing its background property. This will place that group (including the controls owned by that group) on every card created thereafter. If you have already created a bunch of cards you can always add the group by selecting the menu Object > Place Group. The message path then goes from the card to the background to the stack.

Notes[]

A group can exist without being placed on any card. If you set the CantDelete property to true of a group and delete the card of the group, in the Object menu you should see that the group is still available and was never deleted. But if you specifically try to delete the group itself, you won't be able to, at least not without a warning. Unplaced groups are handy for storing resources (usually images and icons) so they are always available and don't need to clutter up a card.

All Group Properties[]

If there are any missing properties, please add.

Advertisement