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
0
Sam
11/9/2012 8:20:27 PM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

3 Replies
4822 Views

Similar Articles

[PageSpeed] 39

> {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
0
Goga
11/10/2012 12:57:39 PM
Reply:

Similar Artilces:

problem with number/number=number ?
hi i need for below 1/36 = 0,0277777777777778 but result should be 1 3/36 should be 1 35/36 should be 1..... (between 1 and 36)/36 should be 1 36/36  and 37/36 and 45/36 and 71/36 should be 2  (between 72 and 37)/36 should be 2  (between 107 and 73)/36 should be 3  and go on how can i do it ? ThanksMark as me if my question or my answer can be helpful for you :) Hi, I think that (int)(n / 36) + 1 will do the trick  hi it work true without below  result 1 for 1/36 and 4 /36 and 35 /36 .. it is true.. but result 2 for 36/36 . res...

When is a number not a number?
I've got some server script that determines the "SELECTED" entry in a SELECT control. (The code below is a snippet.) If no information is returned then I want the number defaulted a hard-coded value, otherwise, I want number that matches the returned value selected. The defaulted, hard-coded value works but the comparison (i == val) doesn't work if a a value was returned in the information. I've verified that it is indeed a number within the range I want. Why would this comparison fail like this? TIA Alan Rosine <snip> if (docInfo.advPayMonths =...

Ann: FastReport FMX for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

Ann: X-platform report generator for Delphi XE3 (FireMonkey 2) and XE2 (FireMonkey) released
Dear friends, Visual report designer is available now on both MS Windows and MAC OS X! Full sources. We can write here full list of possibilities, but it will so long. Let see FastReport VCL and FastReport FMX comparison table: http://www.fast-report.com/en/products/comparison-fast-report-firemonkey-vcl.html And all of this - just now in your hands for business-applications for Mac. Report generator FastReport FMX is the first multiplatform solution for including Business Intelligence into software based on Embarcadero FireMonkey IDE (Delphi for MS Windows and Apple Mac OS X)...

FireMonkey and TEdit.OnChange
I am converting a vcl application to FireMonkey and I must stay it is tedious. In the VCL application I have a TEdit Box which I initialise (in the OnShow event) with {code} ed_EntryString.OnChange := EditBox_NotifiesListbox; ed_EntryString.OnEnter := EditBox_NotifiesListbox; {code} When typing in the edit box the EditBox_NotifiesListbox gets executed as expected. In the Firemonkey version I have (in a self constructed Show event (I also tried in the OnCreate event)) {code} ed_EntryString.OnChange := EditBox_NotifiesListbox; ed_EntryString.OnEnter := EditBox_NotifiesListb...

setfocus not working on firemonkey tedit
Hello Why would a very simple form not set the focus on a tedit I am calling edit1.setfocus but for some reason I still need to toych the control at runtime What am idoing wrong? Clive Morgan wrote: > I am calling edit1.setfocus but for some reason I still need to toych > the control at runtime Depends on when you do it. You need to show your code. -- Dave Nottage [TeamB] Find tips and code samples at Delphi Worlds: http://delphi.radsoft.com.au/blog > {quote:title=Dave Nottage wrote:}{quote} > Clive Morgan wrote: > > > I am calling edit1.se...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

Making Firemonkey more compatible with Delphi
I have programmed in Delphi since 1995 Delphi1 I am now evaluating Delphi XE4. It boggles my mind, why embarcadero has lost the most important aspects of Delphi. Simplicity and Fast User Interface creation. I can easily see how Firemonkey can be improved to bring it in line with traditional Delphi Techniques by doing the following. 1. All Firemonkey controls need a data aware counterpart. 2. Firemonkey Styles need to be converted to TControl descendants. 3. ie. TLayout goes to TPanel ( TFMXPanel ) 4. ie. TRectangle does to TFrame TFMXFrame ) 5. LiveBindings gets placed underneath ( TFMXDataSource ) 6. Style Editor becomes a simple FMX Editor. Unless this is done, I cannot see how XE4 can really take off as a product Kind Regards, Robert. Robert Gilland wrote: > 1. All Firemonkey controls need a data aware counterpart. > 5. LiveBindings gets placed underneath ( TFMXDataSource ) It seems you've missed the point of LiveBindings -- Dave Nottage [TeamB] Robert Gilland wrote: > I have programmed in Delphi since 1995 Delphi1 > > I am now evaluating Delphi XE4. > > It boggles my mind, why embarcadero has lost the most important > aspects of Delphi. > > Simplicity and Fast User Interface creation. > > I can easily see how Firemonkey can be improved to bring it in line > with traditional Delphi Techniques by doing the following. > > > 1. All Firemonkey controls ne...

Where could i find a Serial Number for Delphi?
Just wondering where i might find the serial number of it. If you bought physical product, it's in the box somewhere. If you bought electronic (ESD) the serial number gets emailed to you. Jorge Lopez wrote: > Just wondering where i might find the serial number of it. Hi Jorge, > Just wondering where i might find the serial number of it. Contact your local reseller (or the shop where you bought your copy of Delphi)... Groetjes, Bob Swart -- Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi CodeGear Technology Partner -- Co...

Some number on Delphi 64 bit
In previous threads my colleque was accused of lazyness stc because he didn't look and respond in the other threads first when asking for a 64 bit version. So ok, i thought i would take a look and see how many threads there accually are about it. [how many threads] Searching for 'Delphi 64' on the forum returns 35 threads for this year. of which 17 are really 64 bit compiler related (other are asking if Delphi runs on 64bit systems etc) So the claim that there are over 100 threads is over the top. [how many workarounds] There was also a claim that a lot of w...

Delphi XE2, OSX and FireMonkey?
1. Does anyone know if developing with FireMonkey will be the only way to develop for OSX with XE2? 2. Does anyone know if you will need to compile on a Mac for OSX, or will XE2 cross compile? I know this will all come out during the world tour, but I'm just trying to get some idea so I can start planning. 1. Yes, I think for now it will be the only way. But you can probably build a native UI for OSX by directly using the API, like you can also develop Win32 applications without using the VCL. 2. XE2 will only be available for Windows, but it will compile for other platforms. &l...

Complex number arithmetic in Delphi 2010
Hi, In Delphi 2010, is it possible to overload the operators "+", "-", "*" and "/" in order to be able to perform arithmetic on complex numbers (which have a real and imaginary part)? If so, can anyone point me to some examples of how this can be done. Thanks. Witold Waldman wrote: > In Delphi 2010, is it possible to overload the operators "+", "-", > "*" and "/" in order to be able to perform arithmetic on complex > numbers (which have a real and imaginary part)? If so, can anyone > point...

Number is out of range error in Delphi XE6
I'm using an old Paradox database (BDE) along with an older Delphi 6 program I inherited, and it keeps giving me a Number is out of range error when I hit this statement: POE_Data.OrdersTaxRate.AsFloat:= StrToFloat(Copy(TaxRateLabel.Caption, 1,1)); The TaxRateLabel.Caption equals 7%, and so the StrToFloat is passing just the 7 character. The TaxRate field is defined in the database as a BCD field with 2 decimal places. I don't see any minimum or maximum values set in the database, so why is this producing the number out of range error? Yes, AString = '7', ADouble = 7, and I still get the error when this line executes: POE_Data.OrdersTaxRate.AsFloat := ADouble; I also tried to substitute this in (POE_Data.OrdersTaxRate.AsFloat := 1.0;), but it also produces the same error. > {quote:title=Ian Barker wrote:}{quote} > Michael Hackney wrote: > > > I'm using an old Paradox database (BDE) along with an older Delphi 6 > > program I inherited, and it keeps giving me a Number is out of range > > error when I hit this statement: > > > > POE_Data.OrdersTaxRate.AsFloat:= > > StrToFloat(Copy(TaxRateLabel.Caption, 1,1)); > > > > The TaxRateLabel.Caption equals 7%, and so the StrToFloat is passing > > just the 7 character. The TaxRate field is defined in the database as > > a BCD field with 2 decimal places. I don't see any minimum or maximum > > values set in the da...

TEdit. How to get number of chars after or before cursor
How to get number of chars after or before cursor in Edit component using SelStart. Can be this function modify: {code} void __fastcall TForm1::GetBeforeAfterChars( TEdit* Edit, String& BeforeCh, String& AfterCh ) { String txt = Edit->Text; int sel = Edit->SelStart; BeforeCh = txt.SubString( sel, sel ? 1 : 0 ); AfterCh = txt.SubString( 1 + sel, 1 ); }{code} Hi duf duf _ wrote: > How to get number of chars after or before cursor in Edit component using SelStart. Can be this function modify: > {code} > void __fastcall TForm1::GetBeforeAfterChars( TEdit* Edit, String& BeforeCh, String& AfterCh ) > { > String txt = Edit->Text; > int sel = Edit->SelStart; > > BeforeCh = txt.SubString( sel, sel ? 1 : 0 ); > AfterCh = txt.SubString( 1 + sel, 1 ); > }{code} Maybe: {code} void __fastcall GetBeforeAfterChars( TEdit* Edit, String& BeforeCh, String& AfterCh ) { int sel = Edit->SelStart; BeforeCh = Edit->Text.SubString( 1, sel ); AfterCh = Edit->Text.SubString( sel+1, Edit->Text.Length() - sel ); } {code} Best regards Asger-P http://Asger-P.dk/software QLaunch, INI-Edit and Color Pick Pro. > {quote:title=Asger Joergensen wrote:}{quote} > Hi duf > > duf _ wrote: > > > How to get number of chars after or before cursor in Edit component using SelStart. Can be this function modify: > > {code} &...

Delphi FireMonkey project / testComplete and MSAA
Hi I am actualy working on a new team project developped using FireMonkey. We want to create automated tests with TestComplete which is already used to run tests on some VCL projects. Unfortunatly, we discovered that TestComplete is not directly compatible with FireMonkey application, it only sees the windows but not the controls on it. Making some research we, found that TestComplete is able to identify controls thanks to MSAA. So we created a really short project (only one form with some controls) using the FireMonkey Accessibility Pack in order to look at TestComplete's behavio...

Pop-up on Mobile apps (FireMonkey / Delphi )
Hi everyone, I'm currently working on a FireMonkey mobile app with Delphi (XE6) and since i'm really new to this i'm in need of a little bit of help. For my App i'd like to build in a subscription screen that would work like a pop-up, showing modal on the same form than the login. I've been looking around a bit on the internet but couldn't find any usefull advice. I found a video ("FireMonkey: Showing Modal form with animation and Shadow effect" from Yaroslav Brovin) thad proved me that it was possible, but was unable to find how. I'm sure it'...

Re: Some number on Delphi 64 bit
John Jacobson wrote: > Rudy Velthuis <newsgroups@rvelthuis.de> wrote in message > <185272@forums.codegear.com> > > "Say what you will about the Ten Commandments, you must always > > come back to the pleasant fact that there are only ten of them." > > -- H. L. Mencken > > Actually the fact that there are ten of them is purely arbitrary. Who cares? -- Rudy Velthuis (TeamB) http://www.teamb.com "Giving birth is like taking your lower lip and forcing it over your head." - Carol Burnett. "Rudy Velt...

Delphi, Firemonkey, IOS, and TCP howto?
I was really excited about the new ability to compile IOS apps written in Delphi, but I'm starting to find some major limitations, unless I'm really overlooking something. I want to write an iphone/pad app that needs to retrieve data from a socket connection, or from a webpage (http, webservice, anything). It seems that all of the Firemonkey internet and indy components are not supported within xcode. Am I overlooking something here, or is this a feature that will not be implemented, or is it planned to be implemented? If this kind of communication is not supported, this is a hu...

ANN: Delphi XE2 FireMonkey BOOK
September 5, 2012 Coogara Consulting is pleased to announce that our new book is available: "FireMonkey Development for iOS and OS X with Delphi XE2" by Graeme Chandler. It is available printed (comb binding) or in PDF and MOBI (Kindle compatible) formats. Only from: http://shop.coogara.com Regards Graeme Chandler Coogara Consulting http://www.coogara.com.au http://shop.coogara.com http://www.strikingwood.com.au Graeme Chandler wrote: > Coogara Consulting is pleased to announce that our new book is > available: > > "FireMonkey Dev...

FireMonkey how to limit Tedit input to numeric
Is there a way to limit Tedit to Numeric input only? In Delphi for Windows I use the KeyPress event to capture and delete alpha input, this doesn't work in FireMonkey as there is no KeyPress event. Is there a method for changing the iOS keyboard from alpha to numeric (and back) when switching between Tedits? P.S. FireMonkey is wonderful. I've been looking for a tool like this for years. Thank you so much! Rick Tharp wrote: > Is there a way to limit Tedit to Numeric input only? > > In Delphi for Windows I use the KeyPress event to capture and delete alpha input, ...

Delphi XE5 Firemonkey iOS7 Style (where is it?)
It says here http://www.embarcadero.com/products/rad-studio/whats-new that XE5 has "iOS 7 SDK support and style" Where is the iOS7 style? - All I can see is iOS6 style components. I can compile on iOS7 and it will bring up the keyboard in iOS 7 but none of the drag and drop components from firemonkey are iOS7 style. Am I missing something obvious? > {quote:title=David Templar wrote:}{quote} > It says here http://www.embarcadero.com/products/rad-studio/whats-new that XE5 has "iOS 7 SDK support and style" > > Where is the iOS7 style? - All I can see is iOS6 style components. I can compile on iOS7 and it will bring up the keyboard in iOS 7 but none of the drag and drop components from firemonkey are iOS7 style. > > Am I missing something obvious? What you see in the IDE is one thing. Have you run your app on iOS7 and you see old style? Best Regards, Cristian Peta > {quote:title=Cristian Peta wrote:}{quote} > > {quote:title=David Templar wrote:}{quote} > > It says here http://www.embarcadero.com/products/rad-studio/whats-new that XE5 has "iOS 7 SDK support and style" > > > > Where is the iOS7 style? - All I can see is iOS6 style components. I can compile on iOS7 and it will bring up the keyboard in iOS 7 but none of the drag and drop components from firemonkey are iOS7 style. > > > > Am I missing something obvious? > > What you see in the IDE is one thi...

How to "passwordchar" a TEdit in Firemonkey
Hello: There is no PasswordChar property on the TEdit in firemonkey. How can I hide what the user is typing, ie. password field. I would normally just set the passwordchar property to "*". Thanks, Sidney just set the password property to true > {quote:title=Sidney Egnew wrote:}{quote} > Hello: > > There is no PasswordChar property on the TEdit in firemonkey. How can I hide what the user is typing, ie. password field. I would normally just set the passwordchar property to "*". > > Thanks, Sidney ...

FireMonkey TEdit control / TabItem Transitions
I tried to set the "TextPrompt" property in a TEdit - does this work? Also, does anyone know if there are any other ChangeTabAction transitions other than slide sideways such as flip or slide up - down? Thanks - Davis, ...

Why is the version numbering scheme so chaotic in Delphi?
Hello all, What I find especially displeasing about Delphi is the horribly chaotic way how the product is identified internally. For example, The product "Delphi XE" is stored on my hard drive in the directory "C:\Program files\Embarcadero\Rad Studio\8.0". This would very much suggest it is version 8 of the product, does it not?. But it is not. In order to identify the product in my source code using conditional compilation, I must use awkward directives like {$ifdef VER220} , {$if compilerversion = 15.0} or {$IF Rtlversion = 15.0}. To make matters even more ...