Livecode Wiki
Register
Advertisement

Specifies the back-to-front order of objects on a card or the order of cards in a stack.Syntax:

set the layer of <object> to {<layerNumber> | top | bottom}

Examples:

set the layer of the mouseControl to top -- bring to front
set the layer of last card button to 10
set the layer of player "Splash" to (the number of controls)

Use the layer property to change the tab order of controls, or to change the order of cards within a stack.

If the object is a control, it must appear on the current card in order for its layer to be changed; you can't set the layer of a control on another card.

The layer of a control is its order (from back to front) on the card. If two controls overlap, the one that covers the other has a higher layer. Each control is on a different layer.

To bring a control forward, set its layer to a higher number. To send it back, set its layer to a lower number. You use the form set the layer of object to top to bring the control all the way to the front, and set the layer of object to bottom to send it all the way to the back.

If you set the layer of a control to a number greater than the number of controls on the card, its layer is set equal to the number of controls.

The layer of controls also determines the tab order. When you press the Tab key, the next control whose traversalOn property is true becomes the active (focused) control. For example, to set the tab order of fields in a data entry form, set the layer of each field so that they are in order.

The layer of a group determines the back-to-front position of all the controls in the group at once. The group behaves as a single control, as far as its layer is concerned. When you group or ungroup a group, its controls retain the same back-to-front placement relative to each other, but the group as a whole moves to the front. The layer of a group is one less than the layer of the lowest-layered object in the group.

It is not possible for other controls to be interspersed between the controls in a single group. If the relayerGroupedControls property is set to true, and you set the layer of a grouped control to a number greater than the topmost control in the group, or lower than the bottom-most control in the group, the control is moved out of the group. If the relayerGroupedControls is false, you cannot set the layer of a grouped control without being in group-editing mode.

The layer of a card specifies its position in the stack. Setting the layer of a card moves it to the specified position in the stack.

Changing the layer of an object(glossary) also changes its number property.

See also: number (function), mouseControl (function), control (object), field (object), stack (object), card (object), tabGroupBehavior (property), layer (property), relayerGroupedControls (property), traversalOn (property),

Advertisement