PDA

View Full Version : public property with rtti in delphi?



noeska
01-10-2008, 06:22 PM
Delphi 2005 win32
RTTI

Can i detect if an public (not published) property exists?

I use xml and rtti to add objects on runtime. Now one object can have a list of other objects only the list is a public property and not a published one.
Besides making the list a published property what options do i have?

My idea was that when i encounter an xml child tag with the name of an property of the object it would allow to add the children of that tag to items list. E.g.

<TMyObject>
<Items>
<TChildObject>
<TChildObject>
</Items>
</TMyObject>

So once MyObject is created. The items is found as child. Not it looks if items is a property exists in MyObject. If it does it goes looking for children that are added by the assumed .Add( childitem). But as Items is not published it is not found :-(

Thanks for your answers in advance.

paul_nicholls
02-10-2008, 01:38 AM
AFAIK, it is not possible to do this using RTTI unless the properties are published :(

I think the only other option would be to make your own metadata? for your objects so you can register properties/methods with some internal list and you can then see what properties/methods the object has this way.

cheers,
Paul