Ver Mensaje Individual
  #4  
Antiguo 28-09-2008
Paolo Paolo is offline
Registrado
 
Registrado: jul 2008
Posts: 8
Reputación: 0
Paolo Va por buen camino
Solucionado

Este es el codigo que me salio, tiene cuatro speedbutton, dos button y un label
Código Delphi [-]
var
  Form1: TForm1;
  Btns: array[1..4] of TSpeedButton;

implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
var x,y,t:integer;
begin
 y:=strtoint(label1.Caption);
 t:=4*y;
 if y<=3 then
   label1.caption:=inttostr(y+1) else exit;
  for x:=1 to 4 do
  begin
   Btns[x]:=TSpeedButton(FindComponent('Boton'+IntToStr(x)));
   Btns[x].caption:=inttostr(t+x);
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
var x,y,t:integer;
begin
 y:=strtoint(label1.Caption);
  if y>1 then
   begin
    label1.caption:=inttostr(y-1);
    y:=y-1;
   end;
 t:=4*y;
   for x:=1 to 4 do
    begin
     Btns[x]:=TSpeedButton(FindComponent('Boton'+IntToStr(x)));
     Btns[x].caption:=inttostr(t+(x-4));
    end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var x:integer;
begin
 for x:=1 to 4 do
  begin
   Btns[x]:=TSpeedButton(FindComponent('Boton'+IntToStr(x)));
   Btns[x].caption:=inttostr(x);
  end;
end;

end.

Última edición por marcoszorrilla fecha: 28-09-2008 a las 20:50:36.
Responder Con Cita