Hi Rory,
Is there a way to make the following code shorter / more efficient?
if kBank == 1 then
cabbageSet kBankTrig, "Key1B1", "visible(1)"
cabbageSet kBankTrig, "Key2B1", "visible(1)"
cabbageSet kBankTrig, "Key3B1", "visible(1)"
cabbageSet kBankTrig, "Key4B1", "visible(1)"
cabbageSet kBankTrig, "Key5B1", "visible(1)"
cabbageSet kBankTrig, "Key6B1", "visible(1)"
cabbageSet kBankTrig, "Key7B1", "visible(1)"
cabbageSet kBankTrig, "Key8B1", "visible(1)"
cabbageSet kBankTrig, "Key9B1", "visible(1)"
cabbageSet kBankTrig, "Key10B1", "visible(1)"
cabbageSet kBankTrig, "Key11B1", "visible(1)"
cabbageSet kBankTrig, "Key12B1", "visible(1)"
else
cabbageSet kBankTrig, "Key1B1", "visible(0)"
cabbageSet kBankTrig, "Key2B1", "visible(0)"
cabbageSet kBankTrig, "Key3B1", "visible(0)"
cabbageSet kBankTrig, "Key4B1", "visible(0)"
cabbageSet kBankTrig, "Key5B1", "visible(0)"
cabbageSet kBankTrig, "Key6B1", "visible(0)"
cabbageSet kBankTrig, "Key7B1", "visible(0)"
cabbageSet kBankTrig, "Key8B1", "visible(0)"
cabbageSet kBankTrig, "Key9B1", "visible(0)"
cabbageSet kBankTrig, "Key10B1", "visible(0)"
cabbageSet kBankTrig, "Key11B1", "visible(0)"
cabbageSet kBankTrig, "Key12B1", "visible(0)"
endif
I tried inserting it into a while / do loop but it wouln´t work…
if kBank == 1 then
iCount init 1
while iCount < 13 do
SChannel "Key%dB1", iCount
cabbageSet kBankTrig, SChannel, "visible(1)"
iCount += 1
od
// repeat process for "visible(0)
endif
I´m hoping to add a number of `12 Widget´ sets (x 8 banks) to my GUI and I´m afraid my code will get kinda long unnecessarily?
[EDIT1] Another related question: should I use toFront() instead? Is there CPU considerations if a widget is not visible Vs. in the background (i.e. not being used)?
Thanks for your time!!