This is driving me mad, i have my treeview setup something like:
-PARENT1
---aChild1
---aChild2
-PARENT2
---aChild1
---aChild2
---aChild3
..etc..
what i need to do is two things:
1) when i click on PARENT1 OR PARENT2, i need to delete all its childs
2) then add childs under whichever parent was selected, so far i have only got this which adds to the treeview, but everytime i click the parent its duplicating and duplicating:
I think this would be easy if i know how to delete all childs under the parent i select each time.
Thanks
-PARENT1
---aChild1
---aChild2
-PARENT2
---aChild1
---aChild2
---aChild3
..etc..
what i need to do is two things:
1) when i click on PARENT1 OR PARENT2, i need to delete all its childs
2) then add childs under whichever parent was selected, so far i have only got this which adds to the treeview, but everytime i click the parent its duplicating and duplicating:
Code:
DelphiTreeNode:= tvwMain.Selected;
for l:= 0 to lvwMain.Items.Count -1 do
begin
with tvwMain.Items.AddChild(DelphiTreeNode, lvwMain.Items.Item[l].SubItems[0]) do
begin
ImageIndex:= 0;
SelectedIndex:= 0;
end;
end;
I think this would be easy if i know how to delete all childs under the parent i select each time.
Thanks