Благодарю.
UPD: Пока тему не закрыли.
Возникла ещё одна проблема со схожей задачей.
Ругается: Operator no applicable to this operand type.
Код:
function ProvInputDrobn (ch: char; str: string): Boolean;
begin
if (ch>='0') and (ch<='9') or (ch=#13) or (ch=#8)
then
begin
ProvInputDrobn:=True;
Exit;
End;
Case ch of
'-': if Length(str)=0 then ProvInputDrobn:=True;
',': if (Pos(',',str)=0 and
(str[Length(str)]>='0') and(ругается тут) (str[Length(str)]<='9')
then ProvInputDrobn:=True
else ProvInputDrobn:=False;
end;
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not ProvInputDrobn(Key) then key:=chr(0);
end;
end.