Treats unformatted data as if it were the value of a published property, and writes it directly to a memory stream.
DefineBinaryProperty 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 writing binary data DefineProperties takes a TWriter object and then calls its DefineBinaryProperty method. DefineBinaryProperty writes the property's name and it's data, but only if the HasData parameter is true. Otherwise it does nothing.
The Name parameter specifies the name of the "fake" property to be written to the stream. A "fake" property is a property that is not published, and that exists only in the code for the DefineBinaryProperty method. The Top and Left properties of a non-visual component are examples of "fake" properties. These are also called "defined properties" or "custom defined properties."
The TStreamProc type is the type of the ReadData and WriteData parameters. It is the method-pointer type that points to a procedure (defined in the storing object) that reads or writes a binary representation of the object's data directly to or from the stream passed as its Stream parameter. For TWriter the ReadData parameter is ignored.
The HasData parameter determines at run time whether the "fake" property has data to store (write).
Defined binary properties are quite rare. Persistent objects that store graphics as binary data are the most common use of filer objects to store and retrieve that data. More commonly, objects use the DefineProperty method. The difference between DefineBinaryProperty and DefineProperty is that with DefineBinaryProperty the component reads or writes the binary property directly to or from a memory stream, rather than going through a filer object.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!