Container LayerMode

Adding a ‘container’ layerMode will enable controls within a group to take advantage of acceleratedRendering. Here are some examples of what this could be used for:

Smooth Scrolling Field

Create a group – set its layerMode to container – set its clipsToRect to true.

Create a field within the group – set its layerMode to scrolling.

Set the rect of the field to its formattedRect (so that it does not need to scroll), and its topLeft to the topLeft of the group.

Make sure you keep the rect of the field up to date with the size of its content.

You now have a smooth scrolling field – controlled by scrolling the group containing the field.

Smooth List Control

The DataGrid uses ‘just enough’ grouped rows of controls to show its content in form mode.

With container layerMode, it is possible to mark the surrounding group as a container, then each row group as a dynamic layer.

As each grouped row becomes its own independent sprite, the rows can be moved at no cost – allowing smooth scrolling and animation.

Smooth Animation In Custom Controls

The general use of the container layerMode can help in any situation where you have a (grouped) control which you want to animate smoothly.

Set the layerMode of the containing group(s) to ‘container’ and then you can switch the layerMode of any contained control to dynamic when it needs animated, then back to static afterwards.

Heads Up Display

In some cases you might want a ‘static’ image with transparent regions overlaid over moving objects. Whilst you can do this at the moment (make the static images ‘static layermode’ and moving things ‘dynamic’), they all have to be top-level controls.

With container layerMode, you can create a group with layerMode container, a frontmost ‘heads up display’ static layer and then other objects in the group (under the display layer) with ‘dynamic’ layerMode.

Steven CrightonContainer Layer Mode Examples