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

# TLazDockTree.InsertControl

InsertControl - undocks AControl and docks it into the tree.

## Declaration

Source position: ldocktree.pas line 163

`public procedure TLazDockTree.InsertControl(`
`AControl: TControl;`
`InsertAt: TAlign;`
`DropControl: TControl`
`); override;`

## Description

InsertControl - undocks AControl and docks it into the tree.

It creates a new TDockZone for AControl and inserts it as a new leaf. It automatically changes the tree, so that the parent of the new TDockZone will have the Orientation for InsertAt.

Example 1:

A newly created TLazDockTree has only a DockSite (TLazDockForm) and a single TDockZone - the RootZone, which has as ChildControl the DockSite.

Visual:

    +-DockSite--+
    |           |
    +-----------+

Tree of TDockZone:

    RootZone (DockSite,doNoOrient)

Inserting the first control:

    InsertControl(Form1,alLeft,nil);

Visual:

    +-DockSite---+
    |+--Form1---+|
    ||          ||
    |+----------+|
    +------------+

Tree of TDockZone:

    RootZone (DockSite,doHorizontal)
     +-Zone2 (Form1,doNoOrient)

Dock Form2 right of Form1:

    InsertControl(Form2,alLeft,Form1);

Visual:

    +-DockSite----------+
    |+-Form1-+|+-Form2-+|
    ||        ||       ||
    |+-------+|+-------+|
    +-------------------+

Tree of TDockZone:

    RootZone (DockSite,doHorizontal)
      +-Zone2 (Form1,doNoOrient)
      +-Zone3 (Form2,doNoOrient)