When I create a TmenuItem
programmatically the usual way, the Owner
of the created menu item is passed as a parameter in the Create
function, e.g.:
var NewMenuItem := TMenuItem.Create(MainMen1);
However, when creating a menu item by CLONING it, assigning its Owner property causes an error:
function CloneMenuItem(SourceItem: TMenuItem): TMenuItem;
begin
with SourceItem do
Result := Vcl.Menus.NewItem(Caption, Shortcut, Checked, Enabled, OnClick, HelpContext, Name + 'Cloned');
//Result.Owner := pmMyPopupMenu; // ERROR
end;
So how can I specify the Owner of a cloned TMenuItem
?