Problemas com botoes
Ola, desculpe se já tiver um tópico sobre isso, gostaria de saber como colocar mais opções em um único botão, como podem ver na imagem abaixo com o código.
private
{ Private declarations }
Foperacao: Char;
Ftotal: Real;
procedure Calcular;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Bt2Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(1);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt3Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(3);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt4Click(Sender: TObject);
begin
Resultado.Text :='+'+ FloatToStr(1);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt5Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(1);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt6Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(1);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt7Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(0);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt8Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(0);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt9Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(0);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt10Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(-1);
calcular;
Foperacao :='+';
end;
procedure TForm1.BtAClick(Sender: TObject);
begin
Resultado.Text := FloatToStr(-3);
calcular;
Foperacao :='+';
end;
procedure TForm1.Calcular;
begin
case Foperacao of
'+': Ftotal :=Ftotal +StrToFloat (Resultado.text);
'-': Ftotal :=Ftotal +StrToFloat (baralho.Text);
end;
Resultado.Text := FloatToStr(Ftotal);
baralho.Text :=Floattostr(ftotal);
end;
end.[img]http://arquivo.devmedia.com.br/forum/imagem/461539-20151029-185141%20%281%29.png[/img]
No Edit Baralho queria colocar para sempre que eu clicar em um numero aparecesse mais 1 nos números ao lado -1.
private
{ Private declarations }
Foperacao: Char;
Ftotal: Real;
procedure Calcular;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Bt2Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(1);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt3Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(3);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt4Click(Sender: TObject);
begin
Resultado.Text :='+'+ FloatToStr(1);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt5Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(1);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt6Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(1);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt7Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(0);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt8Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(0);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt9Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(0);
calcular;
Foperacao :='+';
end;
procedure TForm1.Bt10Click(Sender: TObject);
begin
Resultado.Text := FloatToStr(-1);
calcular;
Foperacao :='+';
end;
procedure TForm1.BtAClick(Sender: TObject);
begin
Resultado.Text := FloatToStr(-3);
calcular;
Foperacao :='+';
end;
procedure TForm1.Calcular;
begin
case Foperacao of
'+': Ftotal :=Ftotal +StrToFloat (Resultado.text);
'-': Ftotal :=Ftotal +StrToFloat (baralho.Text);
end;
Resultado.Text := FloatToStr(Ftotal);
baralho.Text :=Floattostr(ftotal);
end;
end.[img]http://arquivo.devmedia.com.br/forum/imagem/461539-20151029-185141%20%281%29.png[/img]
No Edit Baralho queria colocar para sempre que eu clicar em um numero aparecesse mais 1 nos números ao lado -1.
Thiago
Curtidas 0