Author: Jonas Bilinkevicius How to load a main menu into a TTreeView Answer: 1 2 procedure AddToTree(Menu: TMenuItem; Tree: TTreeView; PNode: TTreeNode); 3 var 4 x: Integer; 5 Node: TTreeNode; 6 begin 7 Node := Tree.Items.AddChild(PNode, Menu.Caption); 8 if Menu.Count > 0 then 9 begin 10 for x := 0 to Menu.Count - 1 do 11 begin 12 AddToTree(Menu.Items[x], Tree, Node); 13 end; 14 end; 15 end; 16 17 procedure TForm1.Button1Click(Sender: TObject); 18 var 19 x: Integer; 20 begin 21 TreeView1.Items.Clear; 22 for x := 0 to MainMenu1.Items.Count - 1 do 23 begin 24 AddToTree(MainMenu1.Items[x], TreeView1, nil); 25 end; 26 end;