Back to Devexpress

TcxCustomGridView.OnDragOver Event

vcl-cxgridcustomview-dot-tcxcustomgridview-c4ebb0a1.md

latest3.0 KB
Original Source

TcxCustomGridView.OnDragOver Event

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:

delphi
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;
cpp
void __fastcall TForm1::tvTargetDragOver(TObject *Sender, TObject *Source, int X, int Y, TDragState State, bool &Accept)
{
  Accept = false;
  TcxDragControlObject * DragObject;
  TcxGridSite * GSite;
  if (DragObject = dynamic_cast<TcxDragControlObject*>(Source))
    if (GSite = dynamic_cast<TcxGridSite*>(DragObject->Control))
      Accept = (GSite->GridView->PatternGridView == tvCustomers);
}

See Also

TcxCustomGridTableOptionsBehavior.DragFocusing

TcxCustomGridTableOptionsBehavior.DragHighlighting

TcxCustomGridTableOptionsBehavior.DragOpening

TcxCustomGridTableOptionsBehavior.DragScrolling

TcxCustomGridView.DragMode

TcxCustomGridView.OnDragDrop

Implementing Drag-And-Drop Functionality

TcxCustomGridView Class

TcxCustomGridView Members

cxGridCustomView Unit