Ver Mensaje Individual
  #4  
Antiguo 03-11-2008
[maeyanes] maeyanes is offline
Capo de los Capos
 
Registrado: may 2003
Ubicación: Campeche, México
Posts: 2.732
Reputación: 24
maeyanes Va por buen camino
Hola...

Agregando...

La clase que va a contener las subpropiedades debe descender de TPersistent para que estas puedan guardar sus valores en el DFM.

Código Delphi [-]
interface

type
  TSubProperty = class(TPersistent)
  private
    FNombre: string;
    FApellidos: string;
  published
    property Nombre: string read FNombre write FNombre;
    property Apellidos: string read FApellidos write FApellidos;
  end;

  TParentComponent = class(TComponent)
  private
    FSubProperty: TSubProperty;
    procedure SetSubProperty(Value: TSubProperty);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    property SubProperty read FSubProperty write SetSubProperty;
  end;

implementation

constructor TParentComponent.Create(AOwner: TComponent);
begin
  inherited;
  FSubProperty := TSubProperty.Create
end;

destructor TParentComponent.Destroy;
begin
  FSubProperty.Free;
  inherited
end;

procedure TParentComponent.SetSubProperty(Value: TSubProperty);
begin
  FSubProperty.Assign(Value)  // Tienes que redefinir el método Assign en TSubProperty
  // para poder hacer esto
end;


Saludos...

Última edición por maeyanes fecha: 03-11-2008 a las 15:45:01.
Responder Con Cita