Skip to main content

TdxCustomDockControl.OnStoreDockPosition Event

Enables you to store a custom docking position when undocking the control.

Declaration

property OnStoreDockPosition: TdxDockPositionEvent read; write;

Remarks

When a control is docked to a site, end-users can undock it in one of two ways:

  1. Dragging away from a site.

  2. Double-clicking the control’s caption (if the docking manager Options property’s doDblClickDocking flag is enabled).

At that time, the previous position of the dock control is saved to a TdxDockPosition structure.

You can handle the OnStoreDockPosition event to change these settings. For instance, you can specify that the control must be placed in a different position within its owning tab container when restored. However, when changing the dock state once again, the actual arrangement of dock controls may have changed. For instance, the control’s owning tab container may have been destroyed earlier. In this case, you should handle the OnRestoreDockPosition event to correct the settings of the current control’s layout.

Sender specifies the control whose position is being saved.

APosition contains the control’s original position. You can modify this data if needed.

The sample code below handles the OnStoreDockPosition event to clear the control’s position information. If the event is handled in such manner, the dock control can only be made to float using a double click on its caption. Double-clicking the control’s caption when it is floating will have no effect.

procedure TForm1.dxDockPanel1StoreDockPosition(Sender: TdxCustomDockControl; var APosition: TdxDockPosition);
begin
  with APosition do
  begin
    Parent := nil;
    SiblingAfter := nil;
    SiblingBefore := nil;
  end;
end;
See Also