Информатика. Программирование в Delphi
118
Edit:=Sender as TEdit;
case key of
'0'..'9',#8:;
',','.':
begin
key:=DecimalSeparator;
if pos(key,Edit.Text)<>0 then
key:=#0;
end;
else
key:=#0;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
//Edit1,Edit2,Edit3 процедуры EditKeyPress
Edit1.OnKeyPress:=EditKeyPress;
Edit2.OnKeyPress:=EditKeyPress;
Edit3.OnKeyPress:=EditKeyPress;
Form1.BorderStyle:=bsDialog;
s1:=0;
s2:=0;
s3:=0;
n:=0;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
t:TDateTime;
begin
if (Edit1.Text='')or(Edit2.Text='')or(Edit3.Text='') then
begin
ShowMessage('Необходимо заполнить все поля...');
exit;
end;
t1:=StrToFloat(Edit1.Text);
t2:=StrToFloat(Edit2.Text);
t3:=StrToFloat(Edit3.Text);
s1:=s1+t1;
s2:=s2+t2;