procedure TForm_QueryBill.ComPTextKeyPress(Sender: TObject; var Key: Char);
begin
if Assigned(CurField) then
begin
if (CurField.DataType in [ftFloat, ftCurrency, ftBCD]) then
begin
if not ((key in ['0'..'9', '.', '-', #8])) then
begin
key := #0
end
else
begin
if (Key = '.') and (Pos('.', TEdit(Sender).Text) <> 0) then
Key := #0
else if
(Key = '-') and (Pos('-', TEdit(Sender).Text) <> 0) then
Key := #0;
end;
end
else if (CurField.DataType in [ftAutoInc, ftSmallint, ftInteger, ftWord,
ftBytes, ftLargeint]) then
begin
if not ((Key in ['0'..'9', '-', #8])) then
begin
Key := #0
end
else
begin
if (Key = '-') and (Pos('-', TEdit(Sender).Text) <> 0) then
Key := #0;
end;
end
else
Exit;
end;
end;
procedure TfrmRunStatistic.edtSpaceKeyPress(Sender: TObject;
var Key: Char);
begin
if (not (Key in ['0'..'9'])) and (Key <> '.') and (Key <> chr(8)) then
Key := chr(0);
end;