Skip to content

Instantly share code, notes, and snippets.

@diego-aslz
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save diego-aslz/01e1100c74f7541f4bec to your computer and use it in GitHub Desktop.

Select an option

Save diego-aslz/01e1100c74f7541f4bec to your computer and use it in GitHub Desktop.
procedure VarreItens(MenuItem: TMenuItem; List: TStringList; Nivel: Integer = 0);
var
str: String;
i: Integer;
begin
str = '';
i := 0;
while i < Nivel do
begin
str = str + ' ';
Inc(i);
end;
List.Add(str + MenuItem.Caption);
i := 0;
while i < Length(MenuItem.Items) do
begin
VarreItens(MenuItem.Items[i], List, Nivel + 1);
Inc(i);
end;
end;
procedure VarreItens(MenuItem: TMenuItem; List: TStringList);
var
i: Integer;
begin
List.Add(MenuItem.Caption);
i := 0;
while i < Length(MenuItem.Items) do
begin
VarreItens(MenuItem.Items[i], List);
Inc(i);
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment