Loading...
Logo
Processing Forum
Just noticed something odd with the way the slider handles tick marks.  I have 2 sets of sliders, one which sets a maximum value for an array of  others.  When the new maximum value is set, the tick marks should also change so that I get the correct number jumps between ticks on the second set.  The problem I have found is that tick marks are never removed, only added.  Perhaps somebody could offer another method of achieving what I want, or a solution for removing tick marks.

In this situation, the only time the number of ticks before is different then after is if there are more ticks.
Copy code
  1. void max_RPM(int theRPM)
  2. {
  3.   for(int i=0; i<16; i++)
  4.   {
  5.     println("number of ticks before: " + led[i].getNumberOfTickMarks());
  6.     led[i].setMax(theRPM);
  7.     led[i].setNumberOfTickMarks(theRPM/250+1);
  8.     println("number of ticks after: " + led[i].getNumberOfTickMarks());
  9.   }
  10. }

The code from controlP5 Slider.java for new tick marks:
Copy code
  1. protected ArrayList<TickMark> _myTickMarks;

  2. public void setNumberOfTickMarks(int theNumber) {
  3.       //Added by Swingline to RESET ticks
  4.       //this isn't elegant but....
  5.       _myTickMarks.clear();
  6.       _myTickMarks.trimToSize();

  7. int n = theNumber - _myTickMarks.size();
  8. if (n <= theNumber) {
  9. for (int i = 0; i < n; i++) {
  10. _myTickMarks.add(new TickMark(this));
  11. }
  12. }
I tried using the ArrayList functions clear, remove, trimToSize none worked at removing the tick marks.  


Replies(2)

hi, removing ticks is missing, give me a few days to take a look. best, andreas

andreas schlegel, http://www.sojamo.de