Jump to content

How to get TmainMenu Item Name ?


rencarnacion

Recommended Posts

Hi Ronny Encarnacion. 
 
If I understand correctly, you want to get all captions on items ... 
 
If so, you can use a recursive approach:
procedure ProcessMenu(AMenu: TUniMenuItem; AMemo: TUniMemo);
procedure TMainForm.ProcessMenu(AMenu: TUniMenuItem; AMemo: TUniMemo);
var
  i: integer;
begin
  for i := 0 to AMenu.Count - 1 do
  begin
    AMemo.Lines.Add(AMenu[i].Caption);
    ProcessMenu(AMenu[i], UniMemo1);
  end;
end;
procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  ProcessMenu(UniMainMenu1.Items, UniMemo1);
end;

http://stackoverflow.com/questions/9771057/iterating-over-main-menus-items-including-subitems

 

 

Link to comment
Share on other sites

  • Administrators

 

Is There a way to get a MainMenu  Item name as I can get the Caption of Item ?

 

Example:

 

for I := 0 to MainMenu.Items.Count -1 do

begin

         MemoItem.Lines.add(Mainmenu.Items.name;

end;

 

I thought that was MainMenu.Items.Name

 

Thanks 

 

 

Your above code is correct. Name property to get Name!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...