setSliderAtIndex on/off
-
This snippet is from Davids Video "Creating tabbed interfaces in HISE".
There are 16 buttons here
Each one is supposed to set a value in sliderpack3 to either 100 or 0.
On 100 works
On 0 notWhat is wrong?
const var SliderPack3 = Content.getComponent("SliderPack3"); const var Btn =[]; for (i = 0; i < 16; i++) { Btn[i] = Content.getComponent("MyBtn"+(i+1)); Btn[i].setControlCallback(changeLength); } inline function changeLength(component, value) { if(value) { local idx = Btn.indexOf(component); for (i = 0; i < 16; i++); { SliderPack3.setSliderAtIndex(idx,100); } } else{ SliderPack3.setSliderAtIndex(idx,0); } }
-
@MikeB said in setSliderAtIndex on/off:
inline function changeLength(component, value)
{
if(value)
{
local idx = Btn.indexOf(component);for (i = 0; i < 16; i++); { SliderPack3.setSliderAtIndex(idx,100); } } else{ SliderPack3.setSliderAtIndex(idx,0); }
}
cant see what the loop is doing for you:
inline function changeLength(component, value) { local idx = Btn.indexOf(component); if(value) { SliderPack3.setSliderAtIndex(idx,100); }else{ SliderPack3.setSliderAtIndex(idx,0); } }
-
There are 16 buttons
Each button sets :
with value 1
in Sliderpack3 the slider to 100
with value 0
in sliderpack3 the slider to 0button1 - slider 1
button2 - slider 2
button3 - slider 3
and so on -
@MikeB - yeah thats what the code I just posted does...
-
@Lindon said in setSliderAtIndex on/off:
cant see what the loop is doing for you:
i have only read this - sorry
It works - thank you very much!