TPersistent branch in Delphi

The TPersistent branch includes all VCL and CLX classes that descend from TPersistent but not from TComponent. Persistence determines what gets saved with a form file or data module and what gets loaded into the form or data module when it is retrieved from memory.

Because of their persistence, objects from this branch can appear at design time. However, they can’t exist independently. Rather, they implement properties for components. Properties are only loaded and saved with a form if they have an owner. The owner must be some component.

TPersistent introduces the GetOwner method, which lets the Form Designer determine the owner of the object. Classes in this branch are also the first to include a published section where properties can be automatically loaded and saved. A DefineProperties method lets each class indicate how to load and save properties.

Following are some of the classes in the TPersistent branch of the hierarchy:

  • Graphics such as: TBrush, TFont, and TPen.
  • Classes such as TBitmap and TIcon, which store and display visual images, and TClipboard, which contains text or graphics that have been cut or copied from an application.
  • String lists, such as TStringList, which represent text or lists of strings that can be assigned at design time.
  • Collections and collection items, which descend from TCollection or TCollectionItem. These classes maintain indexed collections of specially defined items that belong to a component. Examples include THeaderSections and THeaderSection or TListColumns and TListColumn.