Skip to main content

TdxCustomDockControl.DockIndex Property

Returns the index of the dock control in its parent’s child collection.

Declaration

property DockIndex: Integer read;

Property Value

Type
Integer

Remarks

Use the DockIndex property to obtain the index of the dock control in its parent’s child collection. The parent dock control can be obtained using the ParentDockControl property. Child controls are available via the Children property.

If a dock control is within a tab container or a side container, the DockIndex property represents its position within the container. For instance, the DockIndex property of a panel corresponding to the first tab of the tab container will return 0. The DockIndex property of the panel corresponding to the second tab will return 1, etc. Tabs are counted from left to right. Children of horizontal side containers are counted in the same order. In vertical side containers, child dock controls are counted from top to bottom.

The sample code below shows how the DockIndex property can be used. It checks whether the parent of the HelpPanel dock panel is a tab container. If so, the panel index is assigned to the ActiveChildIndex property of the tab container to ensure that the panel is currently active.

if HelpPanel.TabContainer <> nil then
  HelpPanel.TabContainer.ActiveChildIndex := HelpPanel.DockIndex;
See Also