Slider allows user to set any value when snapToTicks is true

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: jfx24
    • Component/s: javafx
    • None

      For some reason, the value property accepts any value for Sliders, not even respecting min/max values. There is a secondary method called `adjustValue` that does the right thing (clamping between min and max and honouring snapToTicks).

      The `adjustValue` method however comes with a dire warning:

         * Note: This function is intended to be used by experts, primarily
         * by those implementing new Skins or Behaviors. It is not common
         * for developers or designers to access this function directly.

      This makes no sense. IMHO this method should not exist, and `setValue` should do what `adjustValue` does already. This can trivially be achieved by overriding `set` in the value property:

                    @Override
                    public void set(double v) {
                      super.set(snapValueToTicks(v));
                    }

      Note that the Slider control currently leaves this up to the Behavior to enforce, which IMHO is the absolute wrong place to do this. SnapToTicks is a property of the control, and when set, should not be ignorable by any installed Behavior, nor the programmer by using `setValue` directly.

            Assignee:
            Andy Goryachev
            Reporter:
            John Hendrikx
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: