rencarnacion Posted March 26, 2014 Share Posted March 26, 2014 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 Link to comment Share on other sites More sharing options...
Sherzod Posted March 27, 2014 Share Posted March 27, 2014 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 More sharing options...
rencarnacion Posted March 27, 2014 Author Share Posted March 27, 2014 Hello, I can get the Caption of the Menu Items, the think I Need to get is the Name of the Item not the Caption Thanks Link to comment Share on other sites More sharing options...
Sherzod Posted March 27, 2014 Share Posted March 27, 2014 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 Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted March 27, 2014 Administrators Share Posted March 27, 2014 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 More sharing options...
rencarnacion Posted March 27, 2014 Author Share Posted March 27, 2014 Thanks, Farshad Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now