Jump to content

Recommended Posts

Posted

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 

 

Posted
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

 

 

Posted

 

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

 

 

Sorry Ronny Encarnacion. 
 
Then I do not understand the question ... 
 
Best regards
  • Administrators
Posted

 

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!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...