{
Insert example
This code inserts a menu item after the first item in a menu named FileMenu.
Note that "first" item means item 1 indexed from zero.
} 
procedure TForm1.Button1Click(Sender: TObject);
var
  NewItem: TMenuItem;
begin
  NewItem := TMenuItem.Create(FileMenu);
  try
    NewItem.Caption := 'Do this';
    FileMenu.Insert(1, NewItem);
  except
    NewItem.Free;
    raise; { reraise the exception }
  end;
end;
 
