System.Classes.TReader.DefineProperty

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

virtual void __fastcall DefineProperty(const System::UnicodeString Name, TReaderProc ReadData, TWriterProc WriteData, bool HasData);

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Classes.pas
System.Classes.hpp
System.Classes TReader

Description

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

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.

See Also