В событии OnKeyPress компонента Edit вы можете проводить обработку:
Код:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not ProvInputInt(Key) then Key := #0
end;
А что касается самой функции я бы немножко ее изменил:
Код:
function ProvInputInt (ch: char): Boolean;
begin
ProvInputInt := ch in ['0'..'9',#13,#8];
end;