Streaming Nonpublished Component Data

Chapter 11 indicates that the Delphi IDE automatically knows how to stream the published properties of a component to and from a DFM file. What happens, however, when you have nonpublished data that you want to be persistent by keeping it in the DFM file? Fortunately, Delphi components provide a mechanism for writing and reading programmer-defined data to and from the DFM file.

Defining Properties

The first step in defining persistent nonpublished “properties is to override a component's DefineProperties() method. This method is inherited from TPersistent, and it's defined as follows:

procedure DefineProperties(Filer: TFiler); virtual;

By default, this method handles reading and writing published properties ...

Get Borland® Delphi™ 6 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.