I think that's checking for input validity. The issue we're dealing with is
when setting the value programtically.
The relevant code in mx is this:
setValue(isNaN(proposedValue) ? 0 : proposedValue, false);
So it's changed to 0 before being passed to setValue.
Harbs
On Apr 7, 2013, at 5:45 PM, Frédéric THOMAS wrote:
> Ok, perfect then, maybe I'm wrong, I was reading the mx:NumericStepper:
>
> private function checkValidValue(value:Number):Number
> {
> if (isNaN(value))
> return this.value;
>
> But if you tried it, it's worth :)
>
> -Fred
>
> -----Message d'origine----- From: Harbs
> Sent: Sunday, April 07, 2013 4:37 PM
> To: [email protected]
> Subject: Re: git commit: Added override to set value to ensure it is not set
> to NaN
>
> I just used the test app with mx:NumericStepper, and it's reverted to 0 when
> setting it to NaN. So it looks like the behavior is now equivalent.
>
> Note. It's 0 not minimum, because minimum could be less than 0…
>
> On Apr 7, 2013, at 3:21 PM, Frédéric THOMAS wrote:
>
>> Ok, I just noticed the mx:NumericStepper commitProperties set it to 0 in
>> case of NaN but it never happen because the checkValidValue reset it the old
>> value in case of NaN, it means the Spart one and the Mx one are not
>> consistent, the Mx one doesn’t allows the value to be set with NaN, is this
>> the right answer to apply to the Spark one ?
>>
>> -Fred
>>
>> -----Message d'origine----- From: Harbs
>> Sent: Sunday, April 07, 2013 2:08 PM
>> To: [email protected]
>> Subject: Re: git commit: Added override to set value to ensure it is not set
>> to NaN
>>
>> Okay. Done.
>>
>> I'll set up Mustella when I get a chance…
>>
>> On Apr 7, 2013, at 2:28 PM, Frédéric THOMAS wrote:
>>
>>> Yeah, Range allows to incr/decr in changeValueByStep, so nearestValidValue
>>> is the good place, I haven't seen before because the source code where FB
>>> took me wasn't the good function, I have to fix that, that's a pain.
>>>
>>> -Fred
>>>
>>> -----Message d'origine----- From: Harbs
>>> Sent: Sunday, April 07, 2013 1:21 PM
>>> To: [email protected]
>>> Subject: Re: git commit: Added override to set value to ensure it is not
>>> set to NaN
>>>
>>> Yes. nearestValidValue looks like a good place to fix it. The question is,
>>> should it be in Range, Spinner (what a funny name for a base class…) or
>>> NumericStepper?
>>>
>>> I'm thinking Range make the most sense because NaN is not a valid value…
>>>
>>> On Apr 7, 2013, at 2:08 PM, Frédéric THOMAS wrote:
>>>
>>>> Sorry my bad, you are right, I was looking at another function, I don't
>>>> use usually FB and it sent me elsewhere.
>>>>
>>>> well, nearestValidValue looks to be the place.
>>>>
>>>> -Fred
>>>>
>>>> -----Message d'origine----- From: Frédéric THOMAS
>>>> Sent: Sunday, April 07, 2013 1:00 PM
>>>> To: [email protected]
>>>> Subject: Re: git commit: Added override to set value to ensure it is not
>>>> set to NaN
>>>>
>>>> IMHO, it is more a Spinner thing as the Range doesn’t incr/decr values, so,
>>>> it is valid to set it to a NaN value to say that's a meaningless value but
>>>> the incr/decr have currently no code to manage that situation, that's the
>>>> reason why I thing it could be the place to do it.
>>>>
>>>> What do you think ?
>>>>
>>>> -Fred
>>>>
>>>> -----Message d'origine----- From: Harbs
>>>> Sent: Sunday, April 07, 2013 12:36 PM
>>>> To: [email protected]
>>>> Subject: Re: git commit: Added override to set value to ensure it is not
>>>> set
>>>> to NaN
>>>>
>>>> If 0 is out of range, 0 will be converted to minimum automatically.
>>>>
>>>> But you are probably right. I see no reason to not set it straight to
>>>> minimium.
>>>>
>>>> It should probably also be fixed in Range set value(). Any reason you can
>>>> think of why it should not be fixed there?
>>>>
>>>> If you agree, I'll revert NumericStepper and make the change in Range.as…
>>>>
>>>> Harbs
>>>>
>>>> On Apr 7, 2013, at 12:43 PM, Frédéric THOMAS wrote:
>>>>
>>>>> Hi Harbs,
>>>>>
>>>>> I guess you will have the opportunity to do it again.
>>>>>
>>>>> What if 0 is out of the Range ?
>>>>>
>>>>> I guess the right fix is:
>>>>>
>>>>> if(isNaN(newValue))
>>>>> newValue = minimum;
>>>>>
>>>>> -Fred
>>>>>
>>>>> -----Message d'origine----- From: Harbs
>>>>> Sent: Sunday, April 07, 2013 11:38 AM
>>>>> To: [email protected]
>>>>> Subject: Re: git commit: Added override to set value to ensure it is not
>>>>> set to NaN
>>>>>
>>>>> I thought it was automatically prepended because I created a branch for
>>>>> it. I see that when I deleted the branch, the JIRA number disappeared.
>>>>> Still learning git… ;-)
>>>>>
>>>>> FWIW, it was FLEX-33288
>>>>>
>>>>> Harbs
>>>>>
>>>>> On Apr 7, 2013, at 11:57 AM, Frédéric THOMAS wrote:
>>>>>
>>>>>> Take the habit to prepend the issue id to your commit message, it is
>>>>>> useful
>>>>>> if someone wants to see the modified code from the source tab of the Jira
>>>>>> issue.
>>>>>>
>>>>>> -Fred
>>>>>>
>>>>>> -----Message d'origine----- From: [email protected]
>>>>>> Sent: Sunday, April 07, 2013 9:02 AM
>>>>>> To: [email protected]
>>>>>> Subject: git commit: Added override to set value to ensure it is not set
>>>>>> to NaN
>>>>>>
>>>>>> Updated Branches:
>>>>>> refs/heads/develop 9ec4d1780 -> 53ad8aa03
>>>>>>
>>>>>>
>>>>>> Added override to set value to ensure it is not set to NaN
>>>>>>
>>>>>>
>>>>>> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>>>>>> Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/53ad8aa0
>>>>>> Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/53ad8aa0
>>>>>> Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/53ad8aa0
>>>>>>
>>>>>> Branch: refs/heads/develop
>>>>>> Commit: 53ad8aa037d29e1055ec6b532513fa50df730c81
>>>>>> Parents: 9ec4d17
>>>>>> Author: Harbs <[email protected]>
>>>>>> Authored: Sun Apr 7 09:58:20 2013 +0300
>>>>>> Committer: Harbs <[email protected]>
>>>>>> Committed: Sun Apr 7 09:58:20 2013 +0300
>>>>>>
>>>>>> ----------------------------------------------------------------------
>>>>>> .../spark/src/spark/components/NumericStepper.as | 11 +++++++++++
>>>>>> 1 files changed, 11 insertions(+), 0 deletions(-)
>>>>>> ----------------------------------------------------------------------
>>>>>>
>>>>>>
>>>>>> http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/53ad8aa0/frameworks/projects/spark/src/spark/components/NumericStepper.as
>>>>>> ----------------------------------------------------------------------
>>>>>> diff --git
>>>>>> a/frameworks/projects/spark/src/spark/components/NumericStepper.as
>>>>>> b/frameworks/projects/spark/src/spark/components/NumericStepper.as
>>>>>> index 36a1982..0848245 100644
>>>>>> --- a/frameworks/projects/spark/src/spark/components/NumericStepper.as
>>>>>> +++ b/frameworks/projects/spark/src/spark/components/NumericStepper.as
>>>>>> @@ -740,6 +740,17 @@ public class NumericStepper extends Spinner
>>>>>> /**
>>>>>> * @private
>>>>>> */
>>>>>> + override public function set value(newValue:Number):void
>>>>>> + {
>>>>>> + if(isNaN(newValue))
>>>>>> + newValue = 0;
>>>>>> +
>>>>>> + super.value = newValue;
>>>>>> + }
>>>>>> +
>>>>>> + /**
>>>>>> + * @private
>>>>>> + */
>>>>>> override protected function setValue(newValue:Number):void
>>>>>> {
>>>>>> super.setValue(newValue);
>>>>>>
>>>>>
>>>>
>>>
>>
>