pangare Posted June 15, 2012 Report Share Posted June 15, 2012 Alguém me explica porque meu código só esta fazendo a primeira verificação e parandovar n1,n2,calculo:real;beginif (radiobutton1.Checked = true) and (edit2.Text <>'') thenbeginn1:=StrToFloat(dbtext2.Caption);n2:=StrToFloat(edit2.text);calculo:=n1*n2;edit1.Text:=FloatToStr(calculo); //faz esta verificicação...if (radiobutton2.Checked = true) and (edit2.Text >'0') then //não realiza estabeginn1:=StrToFloat(dbtext3.Caption);n2:=StrToFloat(edit2.text);calculo:=n1*n2;edit1.Text:=FloatToStr(calculo); Quote Link to comment Share on other sites More sharing options...
0 Jhonas Posted June 16, 2012 Report Share Posted June 16, 2012 em que evento esta esse código ? coloque o codigo completo para pode te ajudarabraço Quote Link to comment Share on other sites More sharing options...
0 pangare Posted June 16, 2012 Author Report Share Posted June 16, 2012 salve Jhonas...cara ta no evento "On Change" de um edit,dei uma modificada mas quando coloco a condição para verificar se o campo esta vazio não funcionaprocedure TForm10.Edit2Change(Sender: TObject);var n1,n2,calculo:real;beginif (radiobutton1.Checked) and (edit2.Text<>'') then //verifica se o radiobutton1 esta checado e o edit diferente de vazion1:=StrToFloat(dbtext2.Caption);if (radiobutton1.Checked) and (edit2.Text<>'') //verifica se o radiobutton2 esta checado e o edit diferente de vazion1:=StrToFloat(dbtext3.Caption);n2:=StrToFloat(edit2.text)calculo:=n1*n2;edit1.Text:=FloatToStr(calculo); se poder me ajudar agradeceria passei o dia em cima disso hehe Quote Link to comment Share on other sites More sharing options...
0 Jhonas Posted June 16, 2012 Report Share Posted June 16, 2012 Não utilize o evento On Change, pois cada vez que voce teclar no campo do edit o evento é chamadoutilize no evento OnExit ou em outro botãoabraço Quote Link to comment Share on other sites More sharing options...
0 pangare Posted June 16, 2012 Author Report Share Posted June 16, 2012 Hum... legal... no caso apelei para um button hehehehemas muito obrigado pela atenção Jhonas Quote Link to comment Share on other sites More sharing options...
Question
pangare
Alguém me explica porque meu código só esta fazendo a primeira verificação e parando
var n1,n2,calculo:real;
begin
if (radiobutton1.Checked = true) and (edit2.Text <>'') then
begin
n1:=StrToFloat(dbtext2.Caption);
n2:=StrToFloat(edit2.text);
calculo:=n1*n2;
edit1.Text:=FloatToStr(calculo); //faz esta verificicação...
if (radiobutton2.Checked = true) and (edit2.Text >'0') then //não realiza esta
begin
n1:=StrToFloat(dbtext3.Caption);
n2:=StrToFloat(edit2.text);
calculo:=n1*n2;
edit1.Text:=FloatToStr(calculo);
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.