You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "christofer.dutz@c-ware.de" <ch...@c-ware.de> on 2013/01/03 12:40:10 UTC

NumericInput component?

Hi,

Just wanted to ask, how about adding a new type of input field to Flex. Because in almost all of my projects I the requirement to input numeric values. For this I created a special type of Input component based upon the ordinary spark input. Currently I'm dragging this component into every project I am working on and I guess a lot of you will be doing the same with their NumericInputs (The Numeric spinner does have its problems with handling fractional stuff) ... thought others could be interested in it. It does have the one or the other minor glitch. Perhaps together we could sort them out and have a nice and clean NumericInput field.

What do you think?

Chris


Re: AW: NumericInput component?

Posted by Alex Harui <ah...@adobe.com>.


On 1/3/13 1:42 PM, "christofer.dutz@c-ware.de" <ch...@c-ware.de>
wrote:

> I wasn't suggesting to put it into core immediately.
> I just wanted to send the code without actually committing it, as I don't have
> an idea where to put it ;-)
> 
I would recommend creating a whiteboard folder and putting in there.  Then
folks can try putting it in their projects if they wish.

-- 
Alex Harui
Flex SDK Team
Adobe Systems, Inc.
http://blogs.adobe.com/aharui


AW: NumericInput component?

Posted by "christofer.dutz@c-ware.de" <ch...@c-ware.de>.
I wasn't suggesting to put it into core immediately. 
I just wanted to send the code without actually committing it, as I don't have an idea where to put it ;-)

Chris

-----Ursprüngliche Nachricht-----
Von: Jonathan Campos [mailto:jonbcampos@gmail.com] 
Gesendet: Donnerstag, 3. Januar 2013 18:36
An: flex-dev@incubator.apache.org
Betreff: Re: NumericInput component?

On Thu, Jan 3, 2013 at 10:43 AM, christofer.dutz@c-ware.de < christofer.dutz@c-ware.de> wrote:

> I think such a component would be quite good to have (In this 
> discussion we now already had 3 Implementations of the "same" logic).


I know in the past we've discussed having a "everything and the kitchen sink" project. This is where I would think a component like this would go rather than directly in with the base components. That way there is a clear delineation between what is the core components and what are the extra components created just as helpers (hgroup cough vgroup cough).

--
Jonathan Campos

Re: NumericInput component?

Posted by Jonathan Campos <jo...@gmail.com>.
On Thu, Jan 3, 2013 at 10:43 AM, christofer.dutz@c-ware.de <
christofer.dutz@c-ware.de> wrote:

> I think such a component would be quite good to have (In this discussion
> we now already had 3 Implementations of the "same" logic).


I know in the past we've discussed having a "everything and the kitchen
sink" project. This is where I would think a component like this would go
rather than directly in with the base components. That way there is a
clear delineation between what is the core components and what are the
extra components created just as helpers (hgroup cough vgroup cough).

-- 
Jonathan Campos

AW: NumericInput component?

Posted by "christofer.dutz@c-ware.de" <ch...@c-ware.de>.
Ok ... so I just created an Issue https://issues.apache.org/jira/browse/FLEX-33337 and attached my Implementation to it. 

I think such a component would be quite good to have (In this discussion we now already had 3 Implementations of the "same" logic).
So if we started working on one official version I think we would pretty soon have a really solid implementation (I have never come across a version that worked 100% without any serious hickups).

Chris 



-----Ursprüngliche Nachricht-----
Von: Kessler CTR Mark J [mailto:mark.kessler.ctr@usmc.mil] 
Gesendet: Donnerstag, 3. Januar 2013 17:06
An: flex-dev@incubator.apache.org
Betreff: RE: NumericInput component?


   Although I would like to keep the number with decimals available in a pure number and be able to use it directly.  I would also like to see digit grouping when not editing it... and monetary symbol if it has to deal with finances. 

   One of the quick TextInput setups I have used before, was restrict the allowed characters to [1-9.].  Then inherit the component to include a focusIn/Out functions to replace the formatted view with the editable floating numbers.  But it's still not controlling how large the number can get or the number of decimal places it supports.



-Mark
-----Original Message-----
From: christofer.dutz@c-ware.de [mailto:christofer.dutz@c-ware.de] 
Sent: Thursday, January 03, 2013 6:40
To: flex-dev@incubator.apache.org
Subject: NumericInput component?

Hi,

Just wanted to ask, how about adding a new type of input field to Flex. Because in almost all of my projects I the requirement to input numeric values. For this I created a special type of Input component based upon the ordinary spark input. Currently I'm dragging this component into every project I am working on and I guess a lot of you will be doing the same with their NumericInputs (The Numeric spinner does have its problems with handling fractional stuff) ... thought others could be interested in it. It does have the one or the other minor glitch. Perhaps together we could sort them out and have a nice and clean NumericInput field.

What do you think?

Chris


RE: NumericInput component?

Posted by Kessler CTR Mark J <ma...@usmc.mil>.
   Although I would like to keep the number with decimals available in a pure number and be able to use it directly.  I would also like to see digit grouping when not editing it... and monetary symbol if it has to deal with finances. 

   One of the quick TextInput setups I have used before, was restrict the allowed characters to [1-9.].  Then inherit the component to include a focusIn/Out functions to replace the formatted view with the editable floating numbers.  But it's still not controlling how large the number can get or the number of decimal places it supports.



-Mark
-----Original Message-----
From: christofer.dutz@c-ware.de [mailto:christofer.dutz@c-ware.de] 
Sent: Thursday, January 03, 2013 6:40
To: flex-dev@incubator.apache.org
Subject: NumericInput component?

Hi,

Just wanted to ask, how about adding a new type of input field to Flex. Because in almost all of my projects I the requirement to input numeric values. For this I created a special type of Input component based upon the ordinary spark input. Currently I'm dragging this component into every project I am working on and I guess a lot of you will be doing the same with their NumericInputs (The Numeric spinner does have its problems with handling fractional stuff) ... thought others could be interested in it. It does have the one or the other minor glitch. Perhaps together we could sort them out and have a nice and clean NumericInput field.

What do you think?

Chris


AW: NumericInput component?

Posted by "christofer.dutz@c-ware.de" <ch...@c-ware.de>.
Hi,

the handling of fractional digits was one thing that I had to stick quite some effort into. My component actually prevents entering of invalid chars depending on the active locale handles not only parsing of numeric values depending on the local, but also displaying them. You can restrict it to only allowing positive values as well as restricting/forcing the number of fractional digits, so it does go quite a bit further than Carlos' solution. And it doesn't use a formatter. 

Limitations:
- No support of Grouping chars (currently)
- Some glitches while typing "0.xxx" values.
- Small problem setting the maximum number of fractional digits to infinite (currently the max number of fractional digits is set to 2 per default)

Chris




-----Ursprüngliche Nachricht-----
Von: João Fernandes [mailto:joaopedromartinsfernandes@gmail.com] 
Gesendet: Donnerstag, 3. Januar 2013 13:34
An: flex-dev@incubator.apache.org
Betreff: Re: NumericInput component?

Hi Carlos

to be honest I don't like the fact there are formatters within a visual component, in my opinion, they should never be coupled.
Another issue is that you use "," and "." hardcoded, shouldn't decimal and number grouping separator be configurable so they can take any possible sign?

Regards

João Fernandes

On 3 January 2013 12:24, Carlos Rovira <ca...@codeoscopic.com>wrote:

>
> Maybe this will solve the NS problems and will not need a new component?
> (this code could be refactored to the core parts of the component 
> instead of this kind of solving).
>
> Let me know your opinion.
>
> Thanks
>



-- 

João Fernandes

Re: NumericInput component?

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Hi Joao,

you're right, I was only exposing a patch done to solve a framework
problem. I only one to ask if that was the problem and If we should do
something at "core level" in the component that solves not only my
particular case...now that we can do it :). But the code exposed is not the
proposed solution (I tried to make that clear in my final comment).

2013/1/3 João Fernandes <jo...@gmail.com>

> Hi Carlos
>
> to be honest I don't like the fact there are formatters within a visual
> component, in my opinion, they should never be coupled.
> Another issue is that you use "," and "." hardcoded, shouldn't decimal and
> number grouping separator be configurable so they can take any possible
> sign?
>
> Regards
>
> João Fernandes
>
> On 3 January 2013 12:24, Carlos Rovira <carlos.rovira@codeoscopic.com
> >wrote:
>
> >
> > Maybe this will solve the NS problems and will not need a new component?
> > (this code could be refactored to the core parts of the component instead
> > of this kind of solving).
> >
> > Let me know your opinion.
> >
> > Thanks
> >
>
>
>
> --
>
> João Fernandes
>



-- 
Carlos Rovira
Director de Tecnología
M: +34 607 22 60 05
F:  +34 912 94 80 80
http://www.codeoscopic.com
http://www.directwriter.es
http://www.avant2.es

Re: NumericInput component?

Posted by João Fernandes <jo...@gmail.com>.
Hi Carlos

to be honest I don't like the fact there are formatters within a visual
component, in my opinion, they should never be coupled.
Another issue is that you use "," and "." hardcoded, shouldn't decimal and
number grouping separator be configurable so they can take any possible
sign?

Regards

João Fernandes

On 3 January 2013 12:24, Carlos Rovira <ca...@codeoscopic.com>wrote:

>
> Maybe this will solve the NS problems and will not need a new component?
> (this code could be refactored to the core parts of the component instead
> of this kind of solving).
>
> Let me know your opinion.
>
> Thanks
>



-- 

João Fernandes

Re: NumericInput component?

Posted by Carlos Rovira <ca...@codeoscopic.com>.
Hi Chris,

I solved the problems in the NumericStepper with the following extension
(only share related code since my class has more "own-framework" stuff):

public function NumericStepper()

 {

 super();

   valueFormatFunction = discountFormat;

 valueParseFunction = discountValueParse;

 }


/**

 * fix varius problems in spark NumericStepper

 * -stepSize

 * -NaN values

 */

 public var formatter:NumberFormatter = new NumberFormatter();

 private function discountValueParse(value:String):Number

 {

 var final:Number = formatter.parseNumber(value.replace(",","."));

   if(isNaN(final))

 {

  return 0;

 }

   return final;

 }

  private function discountFormat(value:Number):String

 {

 return value.toString();

 }


Maybe this will solve the NS problems and will not need a new component?
(this code could be refactored to the core parts of the component instead
of this kind of solving).

Let me know your opinion.

Thanks

Carlos





2013/1/3 christofer.dutz@c-ware.de <ch...@c-ware.de>

> Hi,
>
> Just wanted to ask, how about adding a new type of input field to Flex.
> Because in almost all of my projects I the requirement to input numeric
> values. For this I created a special type of Input component based upon the
> ordinary spark input. Currently I'm dragging this component into every
> project I am working on and I guess a lot of you will be doing the same
> with their NumericInputs (The Numeric spinner does have its problems with
> handling fractional stuff) ... thought others could be interested in it. It
> does have the one or the other minor glitch. Perhaps together we could sort
> them out and have a nice and clean NumericInput field.
>
> What do you think?
>
> Chris
>
>


-- 
Carlos Rovira
Director de Tecnología
M: +34 607 22 60 05
F:  +34 912 94 80 80
http://www.codeoscopic.com
http://www.directwriter.es
http://www.avant2.es