Hier mal ein Auszug aus einem alten Projekt:
Delphi-Quellcode:
unit odEdit;
interface
uses
StdCtrls,
{$INCLUDE 'inc\uses.inc'};
type
TodEdit =
class(TEdit)
private
{$INCLUDE 'inc\privat_var.inc'}
{$INCLUDE 'inc\privat_meth.inc'}
protected
public
constructor Create(AOwner: TComponent);
override;
destructor Destroy;
override;
{$INCLUDE 'inc\public_prop.inc'}
procedure WndProc(
var Message: TMessage);
override;
published
{$INCLUDE 'inc\published_prop.inc'}
// Die inc sieht so aus: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// property DataSet: TodDataSet read FDataSet;
// property OnAfterGetData: TNotifyEvent read FOnAfterGetData write FOnAfterGetData;
// property OnBeforeGetData: TNotifyEvent read FOnBeforeGetData write FOnBeforeGetData;
end;
procedure Register;
implementation
uses
Graphics, Controls, Themes, Windows, SysUtils;
procedure Register;
begin
RegisterComponents('
odControls', [TodEdit]);
end;
{ TodEdit }
function TodEdit
{$INCLUDE 'inc\get_od.inc'}
procedure TodEdit
{$INCLUDE 'inc\set_od.inc'}
function TodEdit
{$INCLUDE 'inc\get_PropName.inc'}
procedure TodEdit
{$INCLUDE 'inc\set_PropName.inc'}
function TodEdit
{$INCLUDE 'inc\get_PropText.inc'}
procedure TodEdit
{$INCLUDE 'inc\set_PropText.inc'}
constructor TodEdit.Create(AOwner: TComponent);
begin
inherited;
{$INCLUDE 'inc\create.inc'}
// Die inc sieht so aus: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// FDataSet := TodDataSet.Create(Self);
// DataSet.SetSubComponent(True);
end;
destructor TodEdit.Destroy;
begin
inherited;
end;
procedure TodEdit.WndProc(
var Message: TMessage);
begin
...
inherited;
end;
end.
TodDataSet war von TComponent abgeleitet:
Delphi-Quellcode:
TodDataSet = class(TComponent)
private
...
protected
...
public
...
published
property PropName: String read get_PropName write set_PropName;
end;
Das hat so wunderbar funktioniert.