Custom range sliders in JSUI ?


    Dec 13 2009 | 11:33 am
    Hi guys. If it's possible can anyone give any suggestion on how to build a custom range slider (with similar features to rslider) using JSUI... latley i'm implementing all my custom controls with KnobMan ( http://www.g200kg.com/en/software/knobman.html ), but obviously that can't help me in doing more interactive controls.
    thanx
    a.

    • Dec 13 2009 | 12:44 pm
      There is a js rangeslider by Anders Dahl at http://www.underhund.com/anders/max.php that you could hack. I like it 'cos you can move the whole range with a single mouse drag, as opposed to just the max or min, a feature that would be nice to see in the standard object, cheers Roger
    • Dec 13 2009 | 2:54 pm
      hi, i agreed with roger until i found that rangeslider does accept whole range changes with mouse clicks + modifier keys when i looked at the help file recently. which is great news (when did this change?).
      however, i have another problem with this - i cannot get the cmd-drag feature to work without 'jittering' problems at the minimum / maximum points.
      what am i doing that is stupid? - i post some bad sunday afternoon code incase anyone can help me:
      - sorry for hijacking your thread alfonso...
    • Dec 14 2009 | 1:21 pm
      Try using the code below in a [js] object. Definitely possible to do this with standard max objects but sometimes I find things easier in javascript. The default min and max values are 0 and 127 but you can type in arguments to change this if you want, then simply chain it between the [rslider] outlet and inlet. Use a [deferlow] if the loop causes any issues.
      lh
      var low = jsarguments[1] || 0;
      var high = jsarguments[2] || 127;
      
      function list(a,b) { if (a==low) { outlet(0,"set",low,range); } else if (b==high) { outlet(0,"set",high-range,high); } else { outlet(0,"set",a,b); range = b-a; } }
    • Dec 14 2009 | 3:23 pm
      Those were added to rslider in 5.0.8.