Jump to content
The Code Captain

Setting Events on TPersistent members

Recommended Posts

I write property and component editors for the classes I define so that they can be edited in the IDE.  When editing an object in the IDE's object inspector a standard TPersistent only exposes properties which are not events.  However, some TPersistents (notably anything deriving from TCollectionItem) do expose events.  I would like to have events declared on TPersistent derived objects editable, but I cannot discover what I need to do in my property / component editors so that the IDE will expose them.  I would very much appreciate a link to a sample component / property editor that does this.

Thanks in advance!

Share this post


Link to post
20 minutes ago, The Code Captain said:

I write property and component editors for the classes I define so that they can be edited in the IDE.  When editing an object in the IDE's object inspector a standard TPersistent only exposes properties which are not events.  However, some TPersistents (notably anything deriving from TCollectionItem) do expose events.  I would like to have events declared on TPersistent derived objects editable, but I cannot discover what I need to do in my property / component editors so that the IDE will expose them.  I would very much appreciate a link to a sample component / property editor that does this.

Thanks in advance!

I think all you have to is to define the events with published scope and then register the property editor for that event handler type.

Share this post


Link to post
Posted (edited)

Thanks @PeterBelow for the speedy response.  The events are published.  They are TNotifyEvent which is already handled on other objects.  There is no 'Events' listed for the TPersistent derived objects (but there are for TCollectionItem derived objects and TComponent derived objects).  I have tried using an editor for the TPersistent that changes how properties are enumerated (looking at how the default editor for TComponent works) but I still can't get the IDE to list any Events for something that's derived from TPersistent unless it's also derived from either TCollectionItem or TComponent.

Edited by The Code Captain

Share this post


Link to post

The IDE simply doesn't show events for a TPersistent object that is not derived from TComponent or TCollectionItem.  I found various forum posts going back over 20 years with people struggling with this exact same problem and I haven't seen anyone post a working solution in that time, not even with custom editors.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×