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 Quote 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 Quote 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 Quote 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 Quote 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! Quote Link to comment Share on other sites More sharing options...
rencarnacion Posted March 27, 2014 Author Share Posted March 27, 2014 Thanks, Farshad Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.