[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Controls' (#lcl)

# TWinControl.SetChildZPosition

Updates the position of the child control in the Z plane (i.e. front-to-back).

## Declaration

Source position: controls.pp line 2310

`protected procedure TWinControl.SetChildZPosition(`
`const AChild: TControl;`
`const APosition: Integer`
`);`

## Arguments

`AChild` |  | Control to locate and move in the method.
`APosition` |  | New ordinal position for the control in the Controls property.

## Description

SetChildZPosition repositions the child control in AChild in the display order for the child Controls in the class instance. No actions are performed in the method when:

- The Controls list has not been allocated.
- AChild has not been assigned (contains Nil).
- AChild is not stored in the child Controls for the class instance.

APosition contains the new relative display order on the Z-axis for the specified child control. A value in APosition must be in the range allowed in Controls (0..Controls.Count-1). Smaller values in APosition move the child control towards the front or top of the display order. Larger values move the child control towards the bottom or back of the display order.

SetChildZPosition calls the Move method in Controls to change the ordinal position for the specified control in the list.

If AChild is a TWinControl descendant, the SetChildZPosition method in the widgetset class is used to notify the child controls which have a valid handle. If AChild is a TControl instance, its InvalidateControl method is called to redraw the control using its visibility and opacity settings.

SetChildZPosition is used to implement the SetControlIndex method.

## See also

TWinControl.Controls |  | Provides indexed access to the child controls for the class instance.
TWinControl.ControlCount |  | The number of child controls in the Controls property.
TWinControl.Handle |  | A reference handle to the widgetset class instance associated with this control.
TWinControl.SetControlIndex |  | Updates the position of the child control in the Z plane (i.e. front-to-back).
TControl.InvalidateControl |  | Requests a repaint of the control.