Ver Mensaje Individual
  #7  
Antiguo 08-10-2006
Avatar de Lepe
[Lepe] Lepe is offline
Miembro Premium
 
Registrado: may 2003
Posts: 7.424
Reputación: 29
Lepe Va por buen camino
Es que... con un TObjectList sería muchiiiiisimo más facil, Sin necesidad de bucles, y pudiendo destruirlos y crearlos a voluntad:

Código Delphi [-]

//Cuando lo necesites, creas el TObjectList;
if not Assigned(Lista) then 
  Lista := TObjectList.Create(true);

// Al crear los labels, los añadimos a la lista
var q:TQRLabel;
for i := 1 to NumCampos  do begin
      q := TQRLabel.Create( nil ); // nadie lo destruye, lo haremos nosotros
      With q do
      begin
          campo:=ObtienePalabra(QRLabelnew.caption, ',', i);
          longitud:= length(campo);
          Name       := 'QRLabel' + IntToStr(i);//'txPorc' + IntToStr(aListas[i]);
          AutoSize   := true;
          Font.Name  := 'Courier New';
          Font.Style := [fsBold];
          Height     := 17;
          Left       := nCol;
          Top        := 32;
          Width      := longitud;
          Caption    := campo;
          Parent     := ColumnHeaderBand1;
          nCol:= nCol+(longitud*7);
         Lista.Add(q);
      end;

// Cuando quieras destruirlos:
 FreeAndNil(Lista); // todos..... los qrlabels y la propia lista.

// Si solo quieres destruir los labels:
   Lista.Clear;

Saludos
__________________
Si usted entendió mi comentario, contácteme y gustosamente,
se lo volveré a explicar hasta que no lo entienda, Gracias.
Responder Con Cita