TAdvMainMenu Sub Menu Drawing Issue

In my Delphi XE application I have a TAdvMainMenu 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?

Current code:

procedure TfmMain.UpdateHelpMenu;
  MI: TMenuItem;
  x: Integer;
  while mnShortcutList.Count > 0 do
  for x := 0 to Prefs.Shortcuts.Count-1 do
    if Prefs.Shortcuts[x].Key <> 0 then
      MI := TMenuItem.Create(mnShortcutList);
      MI.Caption := Prefs.Shortcuts[x].HelpCaption;
      MI.ShortCut := Prefs.Shortcuts[x].Shortcut;
      MI.ImageIndex := 79;

Sub Menu Gap

It seems that wrapping the operation with TAdvMainMenu.BeginUpdate and TAdvMainMenu.EndUpdate has solved this issue.

That is indeed recommended for runtime menu updates.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.