Textfield only numbers

How can i make a textfield so that only numbers can be entered as input. I checked the api reference and did research with google but i found no answers. Should i create my own modified version of the textfield class ?

Never used a textfield (only labels), but can’t you just do…

txtField->setString(StringUtils::toString(123));

?

Yes, but this only sets the string in the text field, i mean that the user could only type numbers instead of all letters to the text field

Ah, something that specifies the allowed characters, then? Sorry, can’t help you there.

Any luck yet?