TreeViewToListBox (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following example adds the Text for all items in the tree view to the list box. This example requires a ListBox and a populated TreeView.

Code

procedure TForm1.FormCreate(Sender: TObject);
var
  CurItem: TTreeNode;
begin
  CurItem := TreeView1.Items.GetFirstNode;
  while CurItem <> nil do
  begin
    ListBox1.Items.Add(CurItem.Text);
    CurItem := CurItem.GetNext;
  end;
end;

Uses