rencarnacion Posted March 26, 2014 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
Sherzod Posted March 27, 2014 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
rencarnacion Posted March 27, 2014 Author 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
Sherzod Posted March 27, 2014 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
Administrators Farshad Mohajeri Posted March 27, 2014 Administrators 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
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.