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

# TCustomAnchoredDockManager.UndockControl

UndockControl - removes a control from a docking form. It breaks all anchors and cleans up.

## Declaration

Source position: ldocktree.pas line 246

`public procedure TCustomAnchoredDockManager.UndockControl(`
`Control: TControl;`
`Float: Boolean`
`);`

## Description

UndockControl - removes a control from a docking form.

    It breaks all anchors and cleans up.

      The created gap will be tried to fill up.
      It removes TLazDockSplitter, TLazDockPage and TLazDockPages if they are no
      longer needed.

     Examples:

      Search Order:

      1. A TLazDockSplitter dividing only two controls:

         Before:
         |-------------
         | +--+ | +---
         | |  | | | B
         | +--+ | +---
         |-------------

         The splitter will be deleted and the right control will be anchored to the
         left.

         After:
         |-------------
         | +---
         | | B
         | +---
         |-------------

      2. Four spiral splitters:

         Before:
                  |
               A  |
         ---------|
           | +--+ |  C
         B | |  | |
           | +--+ |
           | ----------
           |   D

         The left and right splitter will be combined to one.

         After:
                  |
               A  |
           -------|
                  |  C
                B |
                  |
                  |------
                  |   D

      3. No TLazDockSplitter. Control is the only child of a TLazDockPage
         In this case the page will be deleted.
         If the TLazDockPages has no children left, it is recursively undocked.

      4. No TLazDockSplitter, Control is the only child of a TLazDockForm.
         The TLazDockForm is deleted and the Control is floated.
         This normally means: A form will simply be placed on the desktop, other
         controls will be docked into their DockSite.

      5. Otherwise: this control was not docked.

## Errors

Raises an exception if the control is already undocked

The latest version of this document can be found at lazarus-ccr.sourceforge.net .