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

# TLazDockTree

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Implements a docking manager using a simple layout.

## Declaration

Source position: ldocktree.pas line 145

`type TLazDockTree = class(TDockTree)`
`protected`
`procedure AnchorDockLayout();` |  | AnchorDockLayout - sets up anchors between all docked controls and helper controls.
`procedure CreateDockLayoutHelperControls();` |  | CreateDockLayoutHelperControls - creates any splitters and pages needed for the dock layout, including recursive creation for child controls.
`procedure ResetSizes();` |  | ResetSizes - splits available size of Zone between children.
`procedure BreakAnchors();` |  | BreakAnchors - detach the anchors of all child controls.
`procedure PaintDockFrame(); override;` |  | PaintDockFrame - finds the cursor position and paints the dock frame of the specified size on the nominated canvas.
`procedure UndockControlForDocking();` |  | UndockControlForDocking - frees anchors from parent and sibling controls.
`function DefaultDockGrabberSize;` |  | DefaultDockGrabberSize - returns the default size for the dock grabber.
`public`
`constructor Create(); override;` |  | Create - constructor for TLazDockTree: creates a docking form if required, sets up a dock manager then calls inherited Create.
`destructor Destroy; override;` |  | Destroy - destructor for TLazDockTree: frees the dock site, annuls the Docksite manager, destroys any images then calls inherited Destroy.
`procedure AdjustDockRect(); override;` |  | AdjustDockRect - offset one of the borders of control rect in order to get space for frame.
`procedure InsertControl(); override;` |  | InsertControl - undocks AControl and docks it into the tree.
`procedure RemoveControl(); override;` |  | RemoveControl - destroy child zone and all parents if they does not contain anything else, then removes the dock control.
`procedure BuildDockLayout();` |  | BuildDockLayout - breaks the current anchors, forms the appropriate helper controls then re-establishes the anchors.
`procedure FindBorderControls();` |  | FindBorderControls - makes splitters for all bordering controls along the specified Side.
`function FindBorderControl();` |  | Gets the control with the specified dock zone and anchor side.
`function GetAnchorControl();` |  | GetAnchorControl - find a control to anchor the Zone's Side.
`procedure PaintSite(); override;` |  | PaintSite - paint bounds for each control and close button (using the supplied handle).
`procedure MessageHandler(); override;` |  | MessageHandler - checks the state of the mouse and takes the appropriate action. Checks whether redraw is needed because of mouse move or change in mouse button status, text needs to be added, etc.
`procedure DumpLayout(); override;` |  | DumpLayout - writes layout of Zone to a file, for debugging purposes etc.
`property AutoFreeDockSite: Boolean; [rw]` |  | AutoFreeDockSite - determines whether the dock site is free.
`end;`

## Inheritance

`TLazDockTree` |  | Implements a docking manager using a simple layout.
`TDockTree` |  | A tree of TDockZone instances where each docked window has one tree.
`TDockManager` |  | The layout manager for a docksite.
`TPersistent`
?
`TObject`

## Description

TLazDockTree is a TDockTree descendant which contains a a tree of TLazDockZones found in a docked window.

Example 1: Docking "A" (source window) to the left of "B" (target window)

    +---+    +----+
    | A | -> | B  |
    +---+    |    |
             +----+

Result:

A new docktree will be created. Height of "A" will be resized to the height of "B". A splitter will be inserted between "A" and "B". And all three are children of the newly created TLazDockForm of the newly created TDockTree.

    +------------+
    |+---+|+----+|
    || A ||| B  ||
    ||   |||    ||
    |+---+|+----+|
    +------------+

- If "A" or "B" were floating controls, the floating dock sites are freed.
- If "A" or "B" were forms, their decorations (title bars and borders) are replaced by docked decorations.
- If "A" had a TDockTree, it is freed and its child dockzones are merged to the docktree of "B". Analog for docking "C" left to "A":

    +------------------+
    |+---+|+---+|+----+|
    || C ||| A ||| B  ||
    ||   |||   |||    ||
    |+---+|+---+|+----+|
    +------------------+

Example 2: Docking A into B

    +-----+
    +---+    |     |
    | A | ---+-> B |
    +---+    |     |
             +-----+

Result:

A new docktree will be created. "A" will be resized to the size of "B". Both will be put into a TLazDockPages control which is the child of the newly created TDockTree.

    +-------+
    |[B][A] |
    |+-----+|
    ||     ||
    || A   ||
    ||     ||
    |+-----+|
    +-------+

Every DockZone has siblings and children. Siblings can either be:

- horizontally (left to right, splitter),
- vertically (top to bottom, splitter),
- or upon each other (as pages, left to right).

InsertControl

Undocks the control and docks it into the manager. For example, to dock Form1 to the left of Form2:

    InsertControl(Form1,alLeft,Form2);

To dock Form1 "into" Form2, into a TDockPage, use Align=alNone.

    InsertControl(Form1,alNone,Form2);

PositionDockRect

Calculates where a control would be placed, if it were to be docked using InsertControl.

RemoveControl

Removes a control from the dock manager.

GetControlBounds

TODO for Delphi compatibility.

ResetBounds

TODO for Delphi compatibility.

SetReplacingControl

TODO for Delphi compatibility.

PaintSite

TODO for Delphi compatibility.

## See also

TDockTree |  | A tree of TDockZone instances where each docked window has one tree.
TDockZone |  | Represents a node in a TDockTree