user1851132
user1851132

Reputation: 341

How to remove all nodes from TVirtualStringTree?

How to remove all nodes, including VirtualStringTree descendants, in the event handler closes the form containing VirtualStringTree ?

Upvotes: 3

Views: 1694

Answers (1)

TLama
TLama

Reputation: 76693

To delete all nodes from a TVirtualStringTree or its descendant use the Clear method (but note that the Clear method is virtual and can be overriden by some descendant. However, the implementer should keep the original purpose of this method, which is clearing the tree. If not, then it's just a wrong implementation in my view:

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  VirtualStringTree1.Clear;
end;

Upvotes: 5

Related Questions