Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 18-10-2003
Rudi Rudi is offline
Miembro
 
Registrado: jul 2003
Ubicación: Venezuela
Posts: 78
Poder: 23
Rudi Va por buen camino
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.-
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 14:20:11.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi