jueca at brturbo.com
Wed Dec 18 08:34:47 CET 2002
I have to write some instances of a TA class(TPersistent) in a property of TB class(TComponent)...
object MyB: TB
Items = <
Caption = 'Hello'
ImageIndex = 3
Caption = 'Bye'
ImageIndex = 4
But I can't (don't want) use TColletion/TCollectionItem in this specific case...
I have it working now, but I need to use a bad programming trick because I use the WriteProperties method of TWriter that is protected, so, I have a
TFakeWriter = class(TWriter)
TFakeReader = class(TReader)
Just to use use this method by casting the Writer (and the Reader for ReadProperty)
I don't like to do this kind of thing
and.. I my mother see it, I'm a dead guy ;)
My WriteData method looks like this:
procedure TB.WriteData(Writer: TWriter);
for i := 0 to ItemCount - 1 do
There is other way to do this?
I think about a lot of BeginProperty / WriteXXX / EndProperty but if I do this, I'll have problems creating another class(TA), if I add some properties to this new class.
I hope you understand my bad english.... :)
More information about the fpc-devel