Hallo,
ich verwende für "Subproperties" folgende Standartvorlage
Delphi-Quellcode:
TMyPersistent = class(TPersistent)
private
FColor : TColor;
FOnChange : TNotifyEvent;
procedure SetColor(Value : TColor);
protected
procedure DoChange; virtual;
public
constructor Create;
destructor Destroy; override;
procedure Assign(Source : TPersistent); override;
property OnChange : TNotifyEvent read FOnChange write SetOnChange;
published
property Color : TColor read FColor write SetColor;
end;
procedure TMyPersistent .SetColor(Value : TColor);
begin
If FColor<>Value then
begin
FColor:=Value;
DoChange;
end;
end;
procedure TMyPersistent .DoChange;
begin
If Assigned(FOnChange) then
FOnChange(Self);
end;
procedure TMyPersistent.Assign(Source : TPersistent); override;
begin
If Source is TMyPersistent then
begin
FColor:=TMyPersistent(Source).Color;
end;
inherited Assign(Source);
end;