I am creating a custom control that derives from the TEdit class, I have included grouped properties that are in another class of type TPersistent, said properties need access to the properties of the class "host" that derives from the TEDit
type
TProperties = class(TPersistent)
private
FDisabledColor: TColor;
...
procedure SetDisabledColor(const Value: TColor);
public
published
property DisabledColor: TColor read FDisabledColor write SetDisabledColor default clGray;
...
end;
type
TMiEdit = class(TEdit)
private
FProperties : TProperties;
protected
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Properties: TProperties read FProperties write FProperties;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('MisControles', [TMiEdit]);
end;
{ TProperties }
procedure TProperties.SetDisabledColor(const Value: TColor);
begin
if Value <> FDisabledColor then
begin
if not enabled then //<----aqui quiero acceder a la propiedad ENABLED de mi clase TMiEdit.
FDisabledColor := Value
end;
end;
{ TMiEdit }
constructor TMiEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FProperties := TProperties.Create;
FProperties.FDisabledColor := clGray;
end;
destructor TMiEdit.Destroy;
begin
FProperties.Free;
inherited Destroy;
end;
end;
end;
Thanks in advance !!