flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: Spark NumericSpinner patch to fix extra digits showing
Date Fri, 13 Sep 2013 16:11:44 GMT
I did some more digging.

At some point, NumericStepper calls NumberFormatter.  I believe there is a
bug in that logic because the NumberFormatter does not get created until
you hit the up/down buttons.

Anyway, the NumberFormatter creates an instance of
flash.globalization.NumberFormatter.  On Windows, it has
fractionalDigits=2 and trailingZeros=true, on Mac, it has
fractionalDigits=3 and trailingZeros=false.  The documentation says that
default values are os-specific.

So, IMO, this issue isn't just about setting fractionalDigits to 0 but
also setting trailingZeros=false.

The puzzling thing to me is that, NumberFormatter is based on
GlobalizationBase which has a lot of code for being a non-display object
that supports styles, but I don't see any code that propagates the default
styles to the NumberFormatter.  That's what seems wrong to me.  If there
was code at instantiation time that got the styles for every property on
NumberFormatter, then folks should be able to set default styles in the
defaults.css or elsewhere and have that affect formatting in their app.

So, I think that's what should be fixed, and then the global selector
should have trailingZeros=false and this problem would go away and we
wouldn't have to tie the number of fractional digits to the stepSize.



On 9/12/13 9:50 PM, "Alex Harui" <aharui@adobe.com> wrote:

>I'm concerned we're going to break someone's app.
>Another scenario I thought of was the 50 cent scenario where you set the
>step size to .5 but want to show 2 digits of cents.  Yes, they can fix
>their apps, but I don't like doing that to people.
>I think I'll drag out my Windows computer and see what FP 11.1 does.
>On 9/12/13 3:05 PM, "Justin Mclean" <justin@classsoftware.com> wrote:
>>> Clever idea.  I didn't try it but from looking at this diff, I wonder
>>> it is ok to tie the number of decimal places to the step size.
>>In most cases (that I can think of) it is. It certainly better than what
>>it's currently doing.
>>>  Couldn't there be a difference like stepping by whole dollars but
>>>wanting to show
>>> cents
>>Can be done by setting the valueFormatFunction.
>>> maybe starting at some fractional value but stepping by whole
>>> integers,
>>Then you need the decimal places 1.05, 2.05, 3.05 etc ect
>>> or having the step size have more decimal places but show fewer
>>> in order to deal with round off?
>>Again you could use valuFormatFunction.
>>What might be a better idea is if the class accepted a user defined data
>>formatter rather than having dataFormatter as private and in settable.
>>> Do we know if we're using the right "field" from the globalization
>>> classes?  Is it a bug in the player we are working around?
>>It probably is a bug as it only happens on Windows, I'd assuming it's
>>getting the 2 decimal places from the locale currency format and using
>>that as the default.
>>It may also be that this is a bug only shows up in recent Flash Player
>>versions on windows.

View raw message