I have created a component derived from TCustomPanel. On that panel I have a published property of a class derived from TOwnedCollection. All is working well and clicking the ellipsis in the object inspector for that property opens the default collection editor where I can manage the TCollectionItems in the list.
TMyCustomPanel = class(TCustomPanel)
private
...
published
property MyOwnedCollection: TMyOwnedCollection read GetMyOwnedCollection write SetMyOwnedCollection;
end;
I would also like to be able to double-click on the panel at design-time and have the collection editor open up by default. I've started off by creating a class derived from TDefaultEditor and registering it.
TMyCustomPanelEditor = class(TDefaultEditor)
protected
procedure EditProperty(const PropertyEditor: IProperty; var Continue: Boolean); override;
end;
RegisterComponentEditor(TMyCustomPanel, TMyCustomPanelEditor);
This seems to be run at the right time, but I'm stuck on how to launch the property editor for the collection at that time.
procedure TMyCustomPanelEditor.EditProperty(const PropertyEditor: IProperty; var Continue: Boolean);
begin
inherited;
// Comes in here on double-click of the panel
// How to launch collection editor here for property MyOwnedCollection?
Continue := false;
end;
Any solution or different approach would be appreciated.