Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TcxCustomGridView.OnDragOver Event

In This Article

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

#Declaration

Delphi
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