Name
GroupLayer -- add layer(s) to group (V10.0)
Synopsis
GroupLayer(group$, layer1[, layer2, ...])
Function
This function can be used to add one or more layers to the layer group specified by group$. If the layer group specified by group$ doesn't exist yet, it will be automatically created by GroupLayer(). Layer groups are simply referenced by a name string that can contain any characters as long as the group's name isn't already used by a layer. The layer(s) that should be added to the group must be specified by their id in the parameters after group$. You can pass an unlimited number of layers to this function.

Once you have finished grouping your layers, you can then pass the group's name to most functions that deal with layers, e.g. you could show a group of layers by simply passing the name of your layer group to ShowLayer(). You could also move all layers of a layer group at once by passing the layer group to MoveLayer() etc.

Note that when passing groups instead of single layers to functions of the layer library, those functions won't treat the layer group as an own entity but will simply apply the respective operation on all layers that are part of the group. For example, if you call MoveLayer() on a layer group and pass 100:100 as the new position, Hollywood won't move the group as a whole to position 100:100 but all group members individually will be moved to 100:100 so that after the call all layers that are part of the group will appear at 100:100, i.e. they all will be at the same position which might not be what you expected. If you want to move layers that are part of a group and preserve their individual position within the group, you need to call TranslateLayer() instead because that allows moving layers relative to their current position. See TranslateLayer for details.

Layers can also be added to a group right when they are created by passing the group's name in the Group tag of the standard drawing tags accepted by all Hollywood functions that add a layer. See Standard drawing tags for details.

To remove a layer from a group, use the UngroupLayer() function. See UngroupLayer for details. As soon as a group doesn't have any more layers attached, it will be automatically deleted.

Another way of grouping layers is to merge them. In comparison to grouping layers, merging layers means to turn them into a single layer. One advantage of merged layers is that they are treated as a whole, for example when showing or hiding them using transition effects. Grouped layers, on the other hand, will show transition effects individually for each group member. See MergeLayers for details.

You need to enable layers before you can use GroupLayer(). See Layers introduction for details.

Inputs
group$
name of the group to add the layer(s) to
layer1
first layer to add to the group
...
further layers to add to the group
Example
EnableLayers
SetFillStyle(#FILLCOLOR)
Box(0, 0, 100, 100, #RED, {Hidden = True})
Box(100, 0, 100, 100, #GREEN, {Hidden = True})
Box(200, 0, 100, 100, #BLUE, {Hidden = True})
GroupLayer("mygroup", 1, 2, 3)
TranslateLayer("mygroup", 170, 190)
ShowLayerFX("mygroup", #SCROLLSOUTH)
The code above creates three hidden 100x100 rectangles, groups them and then moves the group to the center of the 640x480 display and scrolls them in from the south.

Show TOC