Tom Knowlton
asked on
Drag and drop between two TreeViews...
Sorry only 50 points, but I'm getting low on points again. So, if you're feeling chartitable...
I have two TreeViews side by side. I want to duplicate some of the Windows Epxlorer type functionality by enabling "drag-and-drop" (both ways) between the 2 TreeViews.
I'm looking for some sample code that will work with a form plus 2 TreeView components dropped on it and away I go.
Thanks!
I have two TreeViews side by side. I want to duplicate some of the Windows Epxlorer type functionality by enabling "drag-and-drop" (both ways) between the 2 TreeViews.
I'm looking for some sample code that will work with a form plus 2 TreeView components dropped on it and away I go.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>use my code. :)
As if your code wasn't 85% percent copied. You barely changed the names of the variables.
As if your code wasn't 85% percent copied. You barely changed the names of the variables.
ASKER
simonet:
Works great!
Thanks.
Works great!
Thanks.
Glad to know, knowlton.
Funny thing is I never got an e-mail notification that you accepted my answer. Is it me or has EE been very weird in the last 2 days?
Alex
Funny thing is I never got an e-mail notification that you accepted my answer. Is it me or has EE been very weird in the last 2 days?
Alex
ASKER
I suspect EE, 'cause I answered your question.
Reviewing question.
darinw
Customer Service
darinw
Customer Service
ASKER
What I meant to say was, you answered my question and I accepted.
Yes, the points belong to simonet.
Yes, the points belong to simonet.
ASKER
What about 2 TFileListBox components?
procedure TForm1.TreeView1DragOver(S
State: TDragState; var Accept: Boolean);
begin
Accept := Source is TTreeView;
end;
procedure TForm1.TreeView1DragDrop(S
procedure CopyChildNode(ASNode:TTree
var
i:integer;
CNode:TTreeNode;
begin
for i:=0 to ASNode.Count-1 do
begin
CNode:=TTreeView(Sender).I
if ASNode.Item[i].HasChildren
CopyChildNode(ASNode.Item[
end;
end;
var
NNode, SNode, DNode : TTreeNode;
begin
SNode := TTreeView(Source).Selected
DNode := TTreeView(Sender).GetNodeA
if DNode = nil then
NNode := TTreeView(Sender).Items.Ad
else
NNode := TTreeView(Sender).Items.Ad
if SNode.HasChildren then CopyChildNode(SNode,NNode)
//SNode.Delete;
end;