Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Grupo de botones (https://www.clubdelphi.com/foros/showthread.php?t=60317)

Paolo 27-09-2008 20:02:17

Grupo de botones
 
:) Saludos, como se podria hacer esto

botones y valores

7 8 9
10 11 12
< >

Que cuando se pulse > adquieran estos valores y no avance mas

13 14 15
16 17 17

y cuando se pulse el < adquieran estos valores


1 2 3
4 5 6

y que cuando llege aqui no retroceda mas
Gracias

marcoszorrilla 27-09-2008 20:13:58

No veo muy bien como serían esos botones, pero lo que está claro es que si partimos de los valores iniciales sumando o restando 6 a éstos tendríamos el resultado, falta implementarlo de acuerdo al tipo de control que pretendas utilizar.

Un Saludo.

Paolo 28-09-2008 12:31:51

Parte de la solucion
 
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<4 then
   label1.caption:=inttostr(y+1);
  for x:=1 to 4 do
  begin
   Btns[x]:=TSpeedButton(FindComponent('Boton'+IntToStr(x)));
   Btns[x].caption:=inttostr(t+x);
  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;
Me salio de esta manera ahora tengo que hacer la disminucion

Gracias

Paolo 28-09-2008 18:40:33

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.


La franja horaria es GMT +2. Ahora son las 01:56:36.

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