То есть так:
#pas
for i := 0 to Lst.Count-1 do
begin
s := Lst.Items[i];
if s = '(' then
Prn := Last
else if s = ')' then
begin
last := Prn;
Prn := Control.TVItemParent[Prn];
end
else
begin
Last := Control.TVInsert(Prn,Control.Count-1,s);
Control.TVItemImage[Last] := Control.Count-1;
Control.TVItemSelImg[Last] := Control.TVItemImage[Last];
end;
end;