Skip to content

TDataModule

Container for non-visual components.

Declaration

Source position: classesh.inc line 2881

type

  TDataModule = class(TComponent)
  public
    constructor Create;
    constructor CreateNew(AOwner: TComponent);
    constructor CreateNew(AOwner: TComponent; CreateMode: Integer);
    destructor Destroy;
    procedure AfterConstruction;
    procedure BeforeDestruction;
    property DesignOffset: TPoint; {rw}
    property DesignSize: TPoint; {rw}
    property DesignPPI: Integer; {rw}
  published
    property OnCreate: TNotifyEvent; {rw}
    property OnDestroy: TNotifyEvent; {rw}
    property OldCreateOrder: Boolean; {rw}
  end;

Description

TDataModule is a container for non-visual objects which can be used in an IDE to group non-visual objects which can be used by various other containers (forms) in a project. Notably, data access components are typically stored on a datamodule. Web components and services can also be implemented as descendants of datamodules.

TDataModule introduces some events which make it easier to program, and provides the needed streaming capabilities for persistent storage.

An IDE will typically allow to create a descendant of TDataModule which contains non-visual components in it's published property list.

Properties

Member Visibility Description
DesignOffset public Position property needed for manipulation in an IDE.
DesignPPI public Design Time PPI.
DesignSize public Size property needed for manipulation in an IDE.
OldCreateOrder published Determines when OnCreate and OnDestroy are triggered.
See all Properties

Methods

Member Visibility Description
AfterConstruction public Overrides standard TObject behaviour.
BeforeDestruction public
Create public Create a new instance of a TDataModule.
CreateNew public
Destroy public Destroys the TDataModule instance.
See all Methods

Events

Member Visibility Description
OnCreate published Event handler, called when the datamodule is created.
OnDestroy published Event handler, called when the datamodule is destroyed.
See all Events

See also

Name Description
TDataModule.OnCreate Event handler, called when the datamodule is created.