Hola otra vez.
hice una pequeña prueba y esto funciona:
Código:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TArregloEtiquetas=Array of TLabel;
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button1: TButton;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
FArregloEtiquetas: Tarregloetiquetas;
// procedure SetArregloEtiquetas(const Value: array of TLabel);
{ Private declarations }
public
property ArregloEtiquetas:TArregloetiquetas read FArregloEtiquetas;{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
{procedure TForm1.SetArregloEtiquetas(const Value: array of TLabel);
begin
FArregloEtiquetas := Value;
end;}
procedure TForm1.FormCreate(Sender: TObject);
Var i: integer;
Procedure AgregaEtiqueta(J : Integer);
Begin
SetLength(FArregloEtiquetas,high(FArregloEtiquetas)+2);
FArregloEtiquetas[High(FArregloetiquetas)] := components[J] as TLabel;
End;
begin
for i := 0 to ComponentCount-1 do
if Components[i] is TLabel then
AgregaEtiqueta(i);
end;
procedure TForm1.Button1Click(Sender: TObject);
Var I : Integer;
begin
Edit1.Text := inttostr(high(Farregloetiquetas)+1);
for I := low (Farregloetiquetas) to high(farregloetiquetas) do
farregloetiquetas[i].Caption := farregloetiquetas[i].Caption +' '+ inttostr(i);
end;
end.
El boton lo que hace es colocar el indice del arreglo junto al nombre de la etiqueta y colocar en un edit la cantidad de etiquetas. lo unico que faltaría seria limpiar y liberar el arreglo en el ondestroy pero cerré delphi así que te lo dejo a tí.
lo que haces es heredar de esta forma y asi cada una de tus formas tendran un arreglo de componentes propio y sin mas código, puedes añadir el tipo de componente que necesites.
suerte.-