TTreeSelected (Delphi)
Description
The following code uses Item to add the labels of all child nodes of the selected node to a list box when a button is clicked. This example requires a button, a listbox, and a populated treeview.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
I : Integer;
begin
for I := 0 to (TreeView1.Selected.Count - 1) do
ListBox1.Items.Add(TreeView1.Selected.Item[I].Text);
end;
Uses
- Vcl.ComCtrls.TCustomTreeView.Selected ( fr | de | ja )
- Vcl.ComCtrls.TListItems.Item ( fr | de | ja )