Skip to main content

TdxDockingController.GetDockControlAtPos(TPoint) Method

Returns the dock control located at the specified screen coordinates.

Declaration

function GetDockControlAtPos(const P: TPoint): TdxCustomDockControl;

Parameters

Name Type
P TPoint

Returns

Type
TdxCustomDockControl

Remarks

Use the GetDockControlAtPos method to obtain the dock control located at the specified coordinates. The coordinates are specified relative to the top-left corner of the screen via the pt parameter.

First, the GetDockControlAtPos method obtains the control at the specified point. If the control is a dock control or it has a dock control as a parent, the dock control found is returned. If it is not a dock control and doesn’t have such a parent, the GetDockControlAtPos method returns nil.

The code below shows how to obtain the dock panel currently located under the mouse pointer. The OnTimer event of the timer component is handled for this purpose. This can be used, for instance, to display explanatory information about the panel where the mouse is hovering.

procedure TForm1.Timer1Timer(Sender: TObject);
var DockControl: TdxCustomDockControl;
begin
  DockControl := dxDockingController.GetDockControlAtPos(Mouse.CursorPos);
  if DockControl = nil then Exit;
  if DockControl is TdxDockPanel then
  begin
    // perform actions on the panel found here
    // ...
  end;
end;
See Also