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

# TControl.DoDock

Adjusts the control position and extent for the new docksite.

## Declaration

Source position: controls.pp line 1467

`protected procedure TControl.DoDock(`
`NewDockSite: TWinControl;`
`var ARect: TRect`
`); virtual;`

## Arguments

`NewDockSite` |  | The site where the control will be docked, or Nil when it becomes floating.
`ARect` |  | The control's new Bounds, in screen coordinates when NewDockSite is Nil, else in client coordinates of NewDockSite.

## Description

DoDock is an Internal method, called by Dock, to performs actions needed when a control is docked to a docksite.

If NewDockSite=Nil, Parent is set to Nil (in preparation of floating the control). Otherwise ARect is ignored, and recomputed to fit approximately into the ClientRect of the NewDockSite.

Finally the computed coordinates are stored, in BoundsRectForNewParent when the NewDockSite differs from Parent, else in BoundsRect.

## Errors

A correct implementation should allow for computations in a derived class, and accept and handle the changed bounds without any further adjustments.