Bounds checking corrupts typed values

Issue #19 closed
lx45803 created an issue

Create a flock with 2 flames in it. Enable randomization for blend frames. Set Blend frames to 159. Double click whatever number is in Blend frames max to select it, and type 319.

Bounds checking on every number typed prevents the value from being set to less than 159, and typing 3 sets the value in the text field to 159 and moves the cursor in one space, and every subsequent number typed changes the number to something unintended, in this case 1159 (as 11959 is greater than the limit of 10,000)

Bounds checks should only be applied after pressing enter or otherwise deselecting the text field.

Comments (8)

  1. lx45803 reporter

    Typing in a value outside the valid range seems to result in the previous value being retained, rather than the new value being clamped. Is this intentional?

  2. Matt Feemster repo owner

    Yes. Nothing outside the range will be accepted. Adjust the other side of the range to move past either of the limits.

    Also remember you can adjust these values with the mouse wheel just like any other spinner in the program. Hold ctrl while spinning for bigger increments.

  3. lx45803 reporter

    I feel like the standard UI behavior for this situation is to take the new value and clamp it, though I can't name examples off the top of my head.

    Additionally, some feedback about the value being invalid would be nice. modern UIs usually accomplish this with a red outline around the textbox and a brief message, but I'm not sure how easy that would be to implement with whatever UI framework you're using.

    There's more room for improvement here, but the core issue I had is solved, so I'll leave it up to you if you want to polish things up more or close it.

  4. Matt Feemster repo owner

    If you need the min value to be higher than the max, make the max higher first.

    If you need the max value to be less than the min, make the min lower first.

    I am going to close this issue.

  5. Log in to comment