Eto.Forms.NumericStepper bugs

Hi @curtisw,

there seems to be a small buglet when defining a decimal Value for an Eto.Forms.NumericStepper together with either MinValue or MaxValue. If Value has decimal places and is defined first, it will be rounded up or down.

Below example script has two numeric steppers, both have the same properties but they where defined in different order. Note that one stepper opens with a Value of 6.0 but it’s Value of 5.5 has been defined like this:

Eto.Forms.NumericStepper(Value=5.5, MinValue=0.0, MaxValue=10.0, DecimalPlaces=1)

The other numeric stepper does not show this behaviour, it’s been defined like this:

Eto.Forms.NumericStepper(MinValue=0.0, MaxValue=10.0, DecimalPlaces=1, Value=5.5)

Example script: (881 Bytes)


Hi @curtisw, small addendum to NumericStepper:

If MinValue and MaxValue have been set and a user enters a number which is not within this range, it seems that the entered number is always reverted to MinValue.

I’ve tried to handle this on my own by subscribing to the KeyUp or KeyDown or ValueChanged events. But i cannot control it.

Eg. if a user entered a number which is below MinValue i would like to set it to MinValue and if he entered a number which is higher than MaxValue it should set it to MaxValue. Unfortunately, it will always revert to MinValue as soon as the entered value is not within the defined range.

IMHO Eto could handle this better by default.


1 Like

This is behaving as designed - you can’t set a value with decimal places unless you first set how many decimal places it allows first. It’s the same how the current values of MinValue/MaxValue affect what Value is actually set.

This is likely due to the Wrap option. Turning that off would likely change that behaviour. The way the wrapping is implemented (on Windows) doesn’t currently know if the user is using the stepper buttons/arrow keys or typing it manually. I agree it would be more ideal to have it clamp to the MinValue/MaxValue instead in that case.

Thanks @curtisw, the help doc might mention this. It took me a while to find why this error happens.

I’ve tried my_stepper.Wrap = False but cannot see a difference. If my stepper has a range of 0 to 2000 and the user enters 2001 and clicks OK in the my dialog, the value of the stepper is 0. I’ve tried to overcome this but ValueChanged, KeyUp or KeyDown events never see 2001.