RAD Studio VCL Reference
TReader.DefineProperty Method

Defines data the reader object reads as if it were a published property.

procedure DefineProperty(const Name: string; ReadData: TReaderProc; WriteData: TWriterProc; HasData: Boolean); override;
virtual __fastcall DefineProperty(const AnsiString Name, TReaderProc ReadData, TWriterProc WriteData, Boolean HasData);

DefineProperty is called internally by the DefineProperties method of an object that has data it needs to store. DefineProperties takes a generic filer object as its parameter. For reading data DefineProperties takes a TReader object and then calls the DefineProperties method of the reader object. DefineProperty then reads the property's name and its data. 

The Name parameter specifies the name of the "fake" property to be read from the stream. 

The ReadData parameter points to a procedure (defined in the storing object) that reads the object's data which represents a property value to the reader object. For TReader the WriteData parameter is ignored. 

The HasData parameter determines at run time whether the "fake" property has data to store (write). For TReader the HasData parameter is ignored. 

The difference between DefineBinaryProperty and DefineProperty is that the binary property is read directly from a stream, rather than going through a filer object, and binary data is harder to edit as text. 


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!