danke der ansatz sieht fein aus,
leider bekomme ich beim
result := assigned((Sender as TMyControl).PopupMenu);
eine zugriffsverletzung
sonst hätte ich das so gemacht:
Delphi-Quellcode:
fComponent:= AOwner;
fPopUpMenuCreated := not hasPopUp(fComponent);
if fPopUpMenuCreated then
begin
fPopUpMenu := TPopUpMenu.Create(self);
fPopUpMenu.Name := CompName('PopUpMenu');
(fComponent as TMyControl).PopupMenu := fPopUpMenu;
end else
begin
fPopUpMenu := (fComponent as TMyControl).PopupMenu;
end;