incubator-flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Rovira <carlos.rov...@codeoscopic.com>
Subject Re: NumericInput component?
Date Thu, 03 Jan 2013 12:24:58 GMT
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 <christofer.dutz@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message