onControl() triggered during compile
-
I'm trying to make tabbed pages, according to the BasicSynth example in Christoph's repository. I noticed, however, upon compiling the script and starting the plugin onControl() is triggered multiple times messing up the default Page to show. Did anyone in anyone encounter a smiliar problem before? I cant figure out how to set the initial page
const tabControls = Content.getComponent("Controls"); const tabEproms = Content.getComponent("Eproms"); const tabSettings = Content.getComponent("Settings"); const regControls = Content.getComponent("regControls"); const regEproms = Content.getComponent("regEproms"); const regSettings = Content.getComponent("regSettings"); const var tabs = [tabSettings, tabControls, tabEproms]; const var regs = [regSettings, regControls, regEproms]; handleTabs(tabControls); inline function handleTabs(activeTab) { for(i = 0; i < tabs.length; i++) { regs[i].setValue( activeTab == tabs[i]); tabs[i].set("visible", activeTab == tabs[i]); } }
this is in my OnControl Callbacks
function onControl(number, value) { Console.print(number); switch(number) { case regControls: handleTabs(tabControls); break; case regEproms: handleTabs(tabEproms); break; case regSettings: handleTabs(tabSettings); break; } }
i can switch the tabs no problem there, but initially it's always the wrong one (settings) instead of Controls. I put a console output in there and it lists a buttload of numbers when I click compile
-
When you hit compile, or load your project all components that have saveInPreset enabled will have their callbacks triggered. So to prevent this, disable the saveInPreset setting.
-
@d-healey never in a million years would I have figured that out ;) thanks dan! Not it works like a charm! ;)