May 282016
 

Note to self: If you want to clear the items that were added at design time to a TTreeView, you must make sure it has a handle. The following does not work (in Delphi 2007):

constructor TForm1.Create(Owner: TCoponent);
begin
  inherited;
  TreeView1.Items.Clear;
end;

Adding a TreeView1.HandleNeeded makes it work:

constructor TForm1.Create(Owner: TCoponent);
begin
  inherited;
  TreeView1.HandleNeeded
  TreeView1.Items.Clear;
end;

Sorry, the comment form is closed at this time.

%d bloggers like this: