David Duffy 0 Posted July 17, 2021 Hi all, In my Delphi XE application I have a main menu and some of the menu items have a sub menu. The sub menus that are created at design time are aligned to the parent menu item correctly, but the ones I create in code always have a gap between the menu item and the sub menu. Is there some other property of the sub menu items I need to set apart from owner and parent to get them to display correctly? Share this post Link to post
corneliusdavid 214 Posted July 18, 2021 It would help if you showed the code that you tried. You could also create one sub-menu at design-time, then look at the text view of the .dfm to see all the properties it sets to give you a clue. Share this post Link to post
David Duffy 0 Posted July 18, 2021 Here's the code: procedure TfmMain.UpdateHelpMenu; var MI: TMenuItem; x: Integer; begin while mnShortcutList.Count > 0 do mnShortcutList.Delete(0); for x := 0 to Prefs.Shortcuts.Count-1 do begin MI := TMenuItem.Create(mnShortcutList); MI.Caption := Prefs.Shortcuts[x].HelpCaption; MI.ShortCut := Prefs.Shortcuts[x].Shortcut; mnShortcutList.Add(MI); end; end; Share this post Link to post
Vincent Parrett 750 Posted July 21, 2021 Looks like this was solved on the adug forums 😃 Share this post Link to post
corneliusdavid 214 Posted July 22, 2021 Ah! TAdvMainMenu! That explains it. I was thinking that didn't look like the regular TMainMenu. My attempt to replicate it also failed. Share this post Link to post
David Duffy 0 Posted July 23, 2021 Yes, sorry I didn't realise at the time of posting that it was specific to the TMS version. Share this post Link to post