Re: [Lazarus] floating point mask

2009-12-09 Thread ik
You are over engineering this. Here is what I did (not completed yet): TfrmCalculator = class (TForm) edtAmount : TEdit ; edtPerc : TEdit ; edtResult : TEdit ; procedure edtAmountKeyDown (Sender : TObject ; var Key : Word ; Shift : TShiftState ); procedure edtAmountKeyP

Re: [Lazarus] floating point mask

2009-12-09 Thread David Emerson
> David Emerson wrote: > > at first I overlooked "e+" which is valid for val (string, real) Alexander Klenin wrote: > No, it is not: > Val('e+', x, d); What I meant is that I first overlooked 'e' and '+' as valid characters that can appear together within a string to be converted to a float.

Re: [Lazarus] floating point mask

2009-12-07 Thread Alexander Klenin
On Tue, Dec 8, 2009 at 14:50, waldo kitty wrote: > sorry but what is the code below supposed to be showing?? >> On Tue, Dec 8, 2009 at 03:49, David Emerson wrote: >>> at first I overlooked "e+" which is valid for val (string, real) To which i replied: > Alexander Klenin wrote: >> No, it is not

Re: [Lazarus] floating point mask

2009-12-07 Thread waldo kitty
sorry but what is the code below supposed to be showing?? Alexander Klenin wrote: On Tue, Dec 8, 2009 at 03:49, David Emerson wrote: Of course, if you have a set of all the valid characters ['-', '.', '0'..'9', 'e', 'E', '+'], it's not unreasonable to restrict characters outside that set. But

Re: [Lazarus] floating point mask

2009-12-07 Thread Alexander Klenin
On Tue, Dec 8, 2009 at 03:49, David Emerson wrote: > Of course, if you have a set of all the valid characters > ['-', '.', '0'..'9', 'e', 'E', '+'], it's not unreasonable to restrict > characters outside that set. But make sure the set is complete-- at > first I overlooked "e+" which is valid for

Re: [Lazarus] floating point mask

2009-12-07 Thread David Emerson
> You can use any input component, and check e.g. in OnKeyPress whether > the resulting string would be valid. If not, reject the input > character. > > You can use any regex library for the check, but IMO that's overkill > with a single constant format. In your case I'd use the conversion > f

Re: [Lazarus] floating point mask

2009-12-07 Thread Hans-Peter Diettrich
ik schrieb: I'm trying to create some sort of calculator for specific task. I require to allow to input only floating point or integer numbers. I thought to use TMaskEdit for it, but how can i tell it a rule to allow me arbitrary number length including a floating point on arbitrary position ?

[Lazarus] floating point mask

2009-12-07 Thread ik
Hello, I'm trying to create some sort of calculator for specific task. I require to allow to input only floating point or integer numbers. I thought to use TMaskEdit for it, but how can i tell it a rule to allow me arbitrary number length including a floating point on arbitrary position ? In rege