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

# TDockTree

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

A docking manager for tree-style layouts.

## Declaration

Source position: controls.pp line 2209

`type TDockTree = class(TDockManager)`
`protected`
`FRootZone: TDockZone;` |  |
`function HitTest(); virtual;` |  | HitTest - performs a Hit test at the specified mouse position, and returns the Control present there
`procedure PaintDockFrame(); virtual;` |  | PaintDockFrame - paints the nominated control's canvas at the specified position
`procedure UpdateAll;` |  | UpdateAll - bring all data up to date
`procedure SetDockZoneClass();` |  | SetDockZoneClass - specifies the class of dock zone
`public`
`constructor Create(); override;` |  | Create - constructor for TDockTree: sets up the DockSite, performs inherited Create and sets default BorderWidth, creates the RootZone for the Tree
`destructor Destroy; override;` |  | Destroy - destructor for TDockTree: deletes the RootZone then performs inherited Destroy
`procedure BeginUpdate; override;` |  | Start updating the DockSite layout.
`procedure EndUpdate; override;` |  | Finish updating the DockSite layout.
`procedure AdjustDockRect(); virtual;` |  | AdjustDockRect - adjust the docking rectangle for AControl
`procedure GetControlBounds(); override;` |  | Returns the zone bounds of a docked control.
`procedure InsertControl(); override;` |  | InsertControl - position DropCtl relative Control, using the alignment specified by InsertAt
`procedure LoadFromStream(); override;` |  | Restores the layout of the docksite from Stream.
`procedure MessageHandler(); override;`
`procedure PositionDockRect(); override;` |  | Determines the DockRect while dragging a control over the docksite.
`procedure RemoveControl(); override;` |  | Removes the undocked control from the docksite layout.
`procedure SaveToStream(); override;` |  | Saves the docksite layout to Stream.
`procedure SetReplacingControl(); override;` |  | Specifies the control to be replaced subsequently.
`procedure ResetBounds(); override;` |  | ResetBounds refreshes the layout of the docksite
`procedure PaintSite(); override;` |  | Handles special painting of the docksite.
`procedure DumpLayout(); virtual;` |  | DumpLayout - stores layout in a file
`property DockZoneClass: TDockZoneClass; [r]` |  | DockZoneClass - the class of dock zone
`property DockSite: TWinControl; [rw]` |  | DockSite - the site for docking
`property RootZone: TDockZone; [r]` |  | RootZone - the zone that forms the root of the current Dock Tree
`end;`

## Inheritance

`TDockTree` |  | A docking manager for tree-style layouts.
`TDockManager`
`TPersistent`
`TObject`

## Description

A tree-style layout is organized in layers of a specific (horizontal or vertical) orientation. Every node in the tree is either a container for other nodes, or represents a zone with a single docked control. All child zones of an node have the same DockOrientation.

The following documentation is copied from the Controls unit. It is of historical interest only, since it effectively describes the AnchorDocking, implemented in TCustomAnchoredDockManager. AnchorDocking is not related to visual drag-dock procedures, it merely is an attempt to implement just an layout manager.

Both the TLazDockTree and TCustomAnchoredDockManager implementation never was finished, due to problems with the anchor "docking" mechanism.

    This is an abstract class. A real implementation is e.g. in ldocktree.pas.

        Docking means here: Combining several windows to one. A window can here be
        a TCustomForm or a floating control (undocked) or a TDockForm.
        A window can be docked to another to the left, right, top, bottom or "into".
        The docking source window will be resized, to fit to the docking target
        window.

        Example1: Docking "A" (source window) left to "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  ||
           ||   |||   |||    ||
           |+---+|+---+|+----+|
           +------------------+

        Example2: 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 - undock control and dock it into the manager. For example
                        dock Form1 left to a Form2:
                        InsertControl(Form1,alLeft,Form2);
                        To dock "into", into a TDockPage, use Align=alNone.
        PositionDockRect - calculates where a control would be placed, if it would
                           be docked via 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

#lcl.Controls.TDockManager

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