Title: How to reconstruct full paths from a TreeView
var
SL: TStringList;
// for one node...
function TForm1.GetDir(Node: TTreeNode): string;
var
s: string;
begin
s := Node.Text + '\';
while Node.Parent nil do
begin
s := Node.Parent.Text + '\' + s;
Node := Node.Parent;
end;
Result := s;
end;
// for all nodes
procedure TForm1.Nodes_durchgehen(Tree: TTreeView; Node: TTreeNode);
var
i: Integer;
begin
if Node.Count 0 then
begin
for i := 0 to Node.Count - 1 do
begin
Memo1.Lines.Add(GetDir(Node.Item[i]));
if Node.Count 0 then
Nodes_durchgehen(Tree, Node.Item[i]);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// recreate List.
// You should pass the root-node as argument
Nodes_durchgehen(TreeView1, TreeView1.Items[0]);
end;