How to allow only numbers in an Edit?

Asked

Viewed 920 times

0

I have the following code in my role IntegerKeyDown that is in formpai

If not (CharInSet(KeyChar,['0'..'9']))then begin Key:=0; KeyChar:= 0; end;

I call him in some Edits of the Sons. Works perfectly on Windows, but does not work on Android. There is no error, but it does not prevent typing letters and symbols.

2 answers

0

In the XML file where you created Edittext (in your layout) add:

android:inputType="number"

within his attributes.

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.