The TPersistent Branch

Directly below TObject in the VCL hierarchy is TPersistent. TPersistent adds two very important methods to all classes based on it—SaveToStream and LoadFromStream. These methods supply persistence to objects.
For example, when the form designer needs to create a DFM file (a file used to store information about the components on the form), it loops through its components array and calls SaveToStream for all the components on the form. Each component “knows” how to write its changed properties out to a stream (in this case, a text file). Conversely, when the form designer needs to load the properties for components from the DFM file, it loops through the components array and calls LoadFromStream for each component. Thus, any class derived from TPersistent has the ability to save its state information and restore it on demand.

The types of classes in this branch include:

TGraphicsObject, an abstract base class for objects which encapsulate Windows graphics objects: TBrush, TFont, and TPen.
TGraphic, an abstract base class type for objects such as icons, bitmaps, and metafiles that can store and display visual images: TBitmap, TIcon, and TMetafile.
TStrings, a base class for objects that represent a list of strings.
TClipboard, a wrapper for the Windows clipboard, which contains text or graphics that have been cut or copied from an application.

TCollection, TOwnedCollection, and TCollectionItem, maintained indexed collections of specially defined items.


Popular posts from this blog

TClientDataSet::AppendData and TClientDataSet::BeforeGetRecords


Password Remover