Open Tools API
Introduction
Services
Wizards
Messages
Notifiers
Creators
Editors
Debugger
Examples
Custom Forms
Home |
You can define a form class that publishes properties to the Object
Inspector. This is called a custom form. Custom forms work a little differently
from components. Defining a custom form is a four step process:
- Write your class. Inherit from
TForm , TCustomForm , TDataModule ,
or indeed any window control class that inherits from TWinControl . The tricky
part of writing your custom form class is writing the constructor.
- Write a custom module class to add menu items to Delphi's form editor. This is optional.
You can use
TCustomModule (in the DsgnIntf unit). Your custom
module can also control what kinds of components the user is allowed to drop on the form.
- Write a form expert. The form expert creates an instance of your custom form at design
time. Be sure to set the ancestor name to your custom form class name, and define the
unit's source file correctly to use your custom form class and include its unit.
- Put your custom form class in a run-time package. Put your form expert and custom module
in a design time package that uses your run-time package. Register your custom form by
calling
RegisterCustomModule . Install the design-time package in Delphi.
Applications that use your custom form class will have the option to link statically (to
the DCU file) or dynamically (to the package), unless of course you decide not to ship the
DCU or DCP files.
|