Hi,
A complete sample can be found here, and involves assigning events to the custom drag/drop events:
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, AdvCustomControl, AdvTreeViewBase,
AdvTreeViewData, AdvCustomTreeView, AdvTreeView, Types;
type
TForm1 = class(TForm)
AdvTreeView1: TAdvTreeView;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure DoCustomDragOver(Sender: TObject; Source: TObject; Point: TPointF; var Accept: Boolean);
procedure DoCustomDragDrop(Sender: TObject; Source: TObject; Point: TPointF);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.DoCustomDragDrop(Sender, Source: TObject; Point: TPointF);
var
n: TAdvTreeViewVirtualNode;
begin
if Source is TAdvTreeView then
begin
n := (Sender as TAdvTreeView).XYToNode(Point.X, Point.Y);
if Assigned(n) and Assigned(n.node) and
Assigned((Source as TAdvTreeView).DragNode) and Assigned((Source as TAdvTreeView).DragNode.Node) then
begin
n.Node.Nodes.Add.Assign((Source as TAdvTreeView).DragNode.Node);
end;
end;
end;
procedure TForm1.DoCustomDragOver(Sender, Source: TObject; Point: TPointF;
var Accept: Boolean);
begin
Accept := Source is TAdvTreeView;
end;
procedure TForm18.FormCreate(Sender: TObject);
begin
AdvTreeView1.Interaction.DragDropMode := tdmCopy;
AdvTreeView1.OnCustomDragOver := DoCustomDragOver;
AdvTreeView1.OnCustomDragDrop := DoCustomDragDrop;
end;
end.