SliderPackLAF
-
@d-healey I'd prefer my sliderpack values to show 0-100 on my UI - easy, set the sliderpack value to 0-100. However the sliderpack also controls another sliderpack who's values have to be 0-1. Hise doesn't like me using the '/' character in the callback. Any ideas? The reason I'm doing this is because I can't just multiply the value by 100 in CSS.
Line 6791, column 24: '/' is not allowed on the Object type
inline function onSliderPack_NOTE_LENGTH_UIControl(component, value) { SliderPack_NOTE_LENGTH.setSliderAtIndex(value, component.getSliderValueAt(value / 100)); }; Content.getComponent("SliderPack_NOTE_LENGTH_UI").setControlCallback(onSliderPack_NOTE_LENGTH_UIControl);
-
@DanH
value
the slider index not the slider value - you know how to get the value because you're doing it on the next line ;)component.getSliderValueAt(value)
-
@d-healey yes, it wasn't working and I wondered if I was doing it wrong, hence the v in the wrong place. In any case, I can't do:
inline function onSliderPack_NOTE_LENGTH_UIControl(component, value) { SliderPack_NOTE_LENGTH.setSliderAtIndex(value, component.getSliderValueAt(value / 100)); }; Content.getComponent("SliderPack_NOTE_LENGTH_UI").setControlCallback(onSliderPack_NOTE_LENGTH_UIControl);
either...
EDIT - I can do:
inline function onSliderPack_NOTE_LENGTH_UIControl(component, value) { local v = component.getSliderValueAt(value); SliderPack_NOTE_LENGTH.setSliderAtIndex(value, component.getSliderValueAt(v / 100)); }; Content.getComponent("SliderPack_NOTE_LENGTH_UI").setControlCallback(onSliderPack_NOTE_LENGTH_UIControl);
but the linked sliderpack doesn't read the value properly
-
@DanH
component.getSliderValueAt(v / 100)
Do you have 100 sliders? -
@d-healey no
right I'm getting confused, obviously. 32 sliders. I just want to send the value of the sliderpack / 100 to the next sliderpack
-
@DanH Why not set both sliderpacks to use a range of 0 - 1 and then multiply the value for display purposes in your LAF function?
-
@d-healey because I'm using CSS, which can't multiply a value.
-
@DanH Ah i see,
So the slider value you want is:
local v = component.getSliderValueAt(value) / 100;
Then you can set the other sliderpack with:
myOtherSliderPack.setSliderAtIndex(value, v);
-
@d-healey yes, that's what I expected to work, but the value received is still 0-100. Let me make a minimal snippet
-
@d-healey right, don't worry, finally got the right combo
thanks!
-
@DanH
cool! Thank you!