Skip to main content

TdxCustomDockControl.OnDocking Event

Enables you to control whether the dragged dock control can be docked to the current target.

Declaration

property OnDocking: TdxDockingEvent read; write;

Remarks

You can specify how the dock control can be docked to other controls using its AllowDock property. Also, you can specify how other dock controls can be docked to it using its AllowDockClients property. If you need a more flexible approach to specify whether a particular docking operation is allowed, handle the OnDocking event.

The OnDocking event fires repeatedly when the dock control is being dragged over another dock control. The Sender parameter identifies the dragged control. The Zone parameter represents the current target dock zone. You can use properties of the object returned by this parameter to determine the docking type, for instance, by accessing the zone’s DockType property. The target dock control can be obtained by reading the Owner property of the dock zone.

The X and Y parameters specify the current mouse pointer position (in screen coordinates). To obtain the target site’s client coordinates, use its ScreenToClient method. Note that the X and Y parameters are only useful if you need to restrict docking to certain areas of a dock site.

Use the Accept parameter to specify whether the current dock operation is allowed. This parameter value is True by default. Set it to False to prohibit the operation.

Note

after the OnDocking event is raised for a control, the OnCanDocking event is raised for the docking operation target. Thus, the docking operation may still be cancelled by the target control even if it is allowed by the control being dragged.

See Also