Skip to main content

TcxCustomGridView.OnDragOver Event

Occurs when a user drags an object over the current View.

Declaration

property OnDragOver: TDragOverEvent read; write;

Remarks

Write an OnDragOver handler to enable/disable a drag and drop operation at a given point. Set the Accept property to False to reject the object being dragged. Set Accept to True to enable object dropping. In this case, when a user drops an object, the OnDragDrop event is fired. The Source parameter is the object being dragged. Sender refers indirectly to the grid site (a TcxGridSite object) containing the current View. Refer to the OnDragDrop event description for more information on the Sender and Source parameters.

The X and Y parameters are the coordinates of the mouse positioned over the control.

The State parameter specifies the manner in which the dragged object moves over the control.

The following example shows an OnDragOver event handler which accepts a dragged object if the source of the drag-and-drop operation is the tvCustomers View:

procedure TForm1.tvTargetDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
begin
  Accept := False;
  if Source is TcxDragControlObject then
    with TcxDragControlObject(Source) do
      if Control is TcxGridSite then
        with TcxGridSite(Control) do
          Accept := (GridView.PatternGridView = tvCustomers) ;
end;
See Also