Number only TEdit

How can I force a TEdit in firemonky to only accept numbers.

in VCL I could set the style to ES_NUMBER but firemonkey components do not have window handle.

Thank you
Sam
1
Sam
11/9/2012 8:20:27 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

3 Replies
7894 Views

Similar Articles

[PageSpeed] 0

> {quote:title=Sam Firouz wrote:}{quote}
> How can I force a TEdit in firemonky to only accept numbers.

Edit1.FilterChar := '0123456789';

--
MonkeyStyler FireMonkey style designer http://bit.ly/PzxKyI
Embarcadero MVP
0
Mike
11/9/2012 10:02:20 PM
El 09/11/2012 23:02 PM, Mike Sutton escribió:
> Edit1.FilterChar := '0123456789';

Or directly using TNumberBox

http://docwiki.embarcadero.com/Libraries/XE3/en/FMX.Edit.TNumberBox
1
Jose
11/10/2012 9:40:19 AM
this you do onType event of your Edit1;
{code}
var Num:Integer;
begin
 num := StrToIntDef(Edit1.text,0);
 Edit1.text := IntToStr(Num);
end;
{code}

or
{code}
begin
try
 StrToInt(Edit1.text);
except
 Edit1.text := '0';
end;
{code}

Edited by: Goga Goge on Nov 10, 2012 4:57 AM
1
Goga
11/10/2012 12:57:39 PM
Reply: