var MTN : array of TTreeNode;
j:integer;
procedure TForm1.MainmenuToTreeView;
procedure MenuAct(m :TMainMenu);
procedure DoRecursive(t :TMenuItem);
var ii : integer;
begin
for ii := 0 to t.Count-1 do
begin
if ii = 0 then
begin
MTN[j+1] := TreeView1.Items.AddChild(MTN[j],t.Items[ii].Caption);
end else
MTN[j+1] := TreeView1.Items.Add(MTN[j],t.Items[ii].Caption);
inc(j);
DoRecursive(t.Items[ii]);
end;
end;
var i:Integer;
begin
if m.Items.Count > 0 then
for i := 0 to M.Items.Count-1 do
begin
MTN[j+1] := TreeView1.Items.Add(MTN[0],m.Items.Items[i].Caption);
inc(j);
DoRecursive(m.Items[i]);
end;
end;
begin
TreeView1.Items.Clear;
setlength(MTN,50);
J := 0;
MenuAct(MainMenu1);
end;
j:integer;
procedure TForm1.MainmenuToTreeView;
procedure MenuAct(m :TMainMenu);
procedure DoRecursive(t :TMenuItem);
var ii : integer;
begin
for ii := 0 to t.Count-1 do
begin
if ii = 0 then
begin
MTN[j+1] := TreeView1.Items.AddChild(MTN[j],t.Items[ii].Caption);
end else
MTN[j+1] := TreeView1.Items.Add(MTN[j],t.Items[ii].Caption);
inc(j);
DoRecursive(t.Items[ii]);
end;
end;
var i:Integer;
begin
if m.Items.Count > 0 then
for i := 0 to M.Items.Count-1 do
begin
MTN[j+1] := TreeView1.Items.Add(MTN[0],m.Items.Items[i].Caption);
inc(j);
DoRecursive(m.Items[i]);
end;
end;
begin
TreeView1.Items.Clear;
setlength(MTN,50);
J := 0;
MenuAct(MainMenu1);
end;