Componentes - propriedades em subniveis

Top  Previous  Next

uses

  SysUtils, Classes, DesignEditors, DesignIntf;

 

type

  TTesteField = class(TPersistent)

  private

    FProp1: String;

    FProp2: String;

    FProp3: String;

  public

    constructor Create;

  published

    property Prop1: String read FProp1 write FProp1;

    property Prop2: String read FProp2 write FProp2;

    property Prop3: String read FProp3 write FProp3;

  end;

 

  TTeste = class(TComponent)

  private

    { Private declarations }

    FTeste: TTesteField;

  protected

    { Protected declarations }

  public

    { Public declarations }

    constructor Create(AOwner: TComponent); override;

    destructor Destroy; override;

  published

    { Published declarations }

    property Teste: TTesteField read FTeste write FTeste;

  end;

 

procedure Register;

 

implementation

 

procedure Register;

begin

  RegisterComponents('Alex', [TTeste]);

end;

 

{ testeField }

 

constructor TTesteField.Create;

begin

  inherited create;

  FProp1 := '';

  FProp2 := 'Tst';

  FProp3 := 'Teste';

end;

 

{ TTeste }

 

constructor TTeste.Create(AOwner: TComponent);

begin

  inherited;

  FTeste:= TTesteField.Create;

end;

 

destructor TTeste.Destroy;

begin

  FTeste.Free;

  inherited;

end;