Sign in Join
FPDoc Onlineexperiment

TResourceFactory class

In unit resfactory

Factory class for resources

Declaration

pascal
TResourceFactory = class

Description

Resources are represented by descendants of TAbstractResource. Some applications don't need specialized resource classes, and a TGenericResource can be enough. On the other hand, sometimes it is required that a resource of a specific type is created with a more specialized class. This class provides a centralized point for the creation of resources.

TResourceFactory holds a list of registered classes with an associated resource type. When it is requested to create a resource for a given type, it creates a resource of the class associated with that type. If no class matching that type is found, TGenericResource is used.

Usually each resource class registers itself in the initialization section of the unit in which it is implemented.

See also

Methods

RegisterResourceClasspublicRegisters a resource class
CreateResourcepublicCreates a new resource

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.