Ver Mensaje Individual
  #1  
Antiguo 27-01-2005
jymy788 jymy788 is offline
Miembro
 
Registrado: jun 2004
Posts: 120
Reputación: 20
jymy788 Va por buen camino
Creación de componentes en tiempo de ejecución

Buenas a todos.

Vamos a ver, espero que me puedan ayudar. Mi problema es el siguiente:

Me creo en tiempo de ejecución unos groupboxs y después de haberlos creados (que lo hace bien) intento crear dentro de cada uno de ellos un determinado número de tFloatEdits (dependen de un length de un array).

El problema lo tengo al crear los floatEdits porque no puedo ponerle como parent el groupbox correspondiente porque no se guardar su nombre. Os adjunto el código para que me puedan echar un cable ok?

////////////////////////////////////////////////////////////////////////////////
Código Delphi [-]
procedure TFormVerServiciosMensual.CreateFloatEdit1a16(aryServicios: TDArrayString);
 var
   myAryServicios, myParent, listGB1a16Name: TDArrayString;
   i, j, k, topX, leftX, topXEdit : integer;
   parentAux: string;
   WidgetName  : TComponent;
 begin
   // destruimos todos los objetos del panel P1a16
   BfFormDestroy(Self, P1a16); 
   myAryServicios := aryServicios;
   leftX := 1;
   for i:=1 to 16 do
   begin
     WidgetName := TGroupBox.Create(Self);
     with TGroupBox(WidgetName) do
     begin
       Name      := 'GB'+ intToStr(i);
       Caption   := '    '+inttoStr(i)+'    ';
       Parent    := P1a16;  //panel sobre el que se crean los groupboxes
       Left      := leftX;
       Top       := 1;
       Width     := 53;
       Height    := 192;
     end;
     leftX := leftX + 53;
     for j:=0 to length(myAryServicios)-1 do
     begin
       // destruimos todos los objetos hijos del Frame de parametros
       //BfFormDestroy(Self, TGroupBox(WidgetName));
       with TFloatEdit.Create(Self) do
       begin
         Name      := 'FloatEdit'+ intToStr(i)+intToStr(j);
         Hint      := myAryServicios[i];
         Parent    := TGroupBox(WidgetName);
         Left      := 6;
         Top       := topXEdit;
         Font.Size := 8;
         Width     := Width + 4;
       end;
       // next
       topXEdit := topXEdit + 35;
     end;
   end;
 end;
////////////////////////////////////////////////////////////////////////////////

Gracias de antemano a todo el foro.

Pd.- Espero haberme explicado bien.

Última edición por marcoszorrilla fecha: 27-01-2005 a las 15:39:33. Razón: Añadir etiquetas Delphi
Responder Con Cita