Ver Mensaje Individual
  #8  
Antiguo 07-04-2006
zvf zvf is offline
Miembro
 
Registrado: abr 2006
Posts: 158
Reputación: 19
zvf Va por buen camino
Gracias a todos!
Vean, creo que por ahi va el asunto, porque yo creo un boton en tiempo de ejecucion, mi codigo es el siguiente:

Código Delphi [-]
Procedure TFPrincipal.CreaBoton;
  var NewBoton : TLabel;
      nombre : string;
      scontador:string;
      sventana_actual : string;
   begin
       if (band = 0) then  //PRIMER BOTON QUE CREA
               begin
               ventana_actual:=1;
               sventana_actual:= IntToStr (ventana_actual);
               margen_izq := margen_izq_ini;
               margen_sup := margen_sup_ini;
               band := 1;
               end
        else
               begin
                margen_izq := margen_izq_ant;
                margen_sup := margen_sup_ant + alto_boton + margen_sup_ini;
                if (margen_sup > margen_inf) then
                    begin
                     margen_izq := margen_izq + margen_izq_ini;
                     margen_izq := margen_izq + ancho_boton;
                     margen_sup := margen_sup_ini;
                    end;
                if (margen_izq > margen_dere) then
                    begin
                     margen_izq := margen_izq_ini;
                     margen_sup := margen_sup_ini;
                     ventana_actual := ventana_actual+1;
                     sventana_actual:= IntToStr (ventana_actual);
                    end;
               end;
     with NewBoton do
        begin
        case ventana_actual of
          1: begin
             NewBoton := TLabel.create(FPrincipal.GroupBoxProd1);
             Parent := FPrincipal.GroupBoxProd1;
             end;
          2: begin
             NewBoton := TLabel.create(FPrincipal.GroupBoxProd2);
             Parent := FPrincipal.GroupBoxProd2;
             end;
          3: begin
             NewBoton := TLabel.create(FPrincipal.GroupBoxProd3);
             Parent := FPrincipal.GroupBoxProd3;
             end;
          4: begin
             NewBoton := TLabel.create(FPrincipal.GroupBoxProd4);
             Parent := FPrincipal.GroupBoxProd4;
             end;
          end;
        scontador:= IntToStr (contador);
        nombre:= 'Boton';
        Name := nombre+scontador;
        Color:= clMoneyGreen;
        Width := ancho_boton;
        Height := alto_boton;
        Left := margen_izq;
        Autosize := false;
        Top := margen_sup;
        Caption := varCaption;
        if soyingrediente <>1 then
             OnClick := mostrar_productos
        else
             OnClick := mostrar_productos;
        margen_izq_ant := margen_izq;
        margen_sup_ant := margen_sup;
      end; //fin del con hacer
  end;
//////  FIN DEL PROCEDIMIENTO CREAR UN BOTON EN TIEMPO DE EJECUCION   /////////
Responder Con Cita