0

I have 3 NSSliders and NSTextFields set with bindings.

Each slider represents an NSInteger value, one column is low, one column is medium and one column is high. I've set Low's max to 98, Medium's max to 99, and High's max to 100. The range of values is 0-100 and the difference between each slider represents an available range:

Example: if Low is 10 and Medium is 21, Low is 10-21 whereas Medium is 21-High's Value.

How can I make low always be lower than medium and high, medium always between low and high, and high always greater than low and medium?

Ideally I'd like to be able to slide one of them and have the other sliders slide automatically if one of the conditions is met-- but I'm not sure of the best way to go about this (I have a TON of conditional statements right now, doesn't seem right and doesn't always work).

aroooo
  • 4,726
  • 8
  • 47
  • 81

1 Answers1

1
[slider setTarget:self]; // assume the handler is [self sliderDidMove:]
[slider setAction:@selector(sliderDidMove:)];

and in sliderDidMove change the value for the other slider

[self.otherSlider setDoubleValue:0.1];
Omarj
  • 1,151
  • 2
  • 16
  • 43
  • 1
    My question is more about the algorithm of keeping them within appropriate ranges than how to move the slider. – aroooo Dec 10 '12 at 21:52