Trigger Panels Off/On via button
-
You can simplify this a lot. Also it's not good practice to grab component references within a callback, that should be done once, in on init, and the references stored in
const
sHiseSnippet 1035.3ocsV80aaaCDmx1JqxasnEne.XCFJbPKRs255FPW2bic7lwVRLlSCJvvZGsDsMQnHEjnRiwP+FsOW6487dI6nnjobsqiiGldvv2++cGOdGGDK8oIIxXji2oyhnHmOyc3LgZZmoDl.0uKx4NtGQRTzXrg0AyhHIIz.jiS0ePyvwqFJ66u+9CHbhvmZYgPmIY9zelExTVtCZ+SLNuGIfdJKrj1OsceeonijKSA7T0sIJh3eNYB8XhVsJtHmcNLfojwCUDEMAz4.YvrgSkuSXz+LVBaDmpIZgFBNxvF0YJiGLnHWSPHmZCrYdUSlee2iXAr47sUf6lI.asnbMvox5fTqa.jbJAoZFHcO2g9wrHkUhFOepaeAbfLl.k5xPwnKpxeV0siDzPn1OjbNsWLPL2hFOqYyGige1640q+jm7.bjfeJYTcnxmnxIvu.W3fIT0K47NxvHo.nSZrqQkcKLejR7ir.JnTtKrLVzMy8QicspncikZ+DsZBUrj2gv4ifS+FRgUdtLcnYBNSPwiSE9JlTfWgZM7Kh3iwWP3oz8p+G08fP.vO6TgwYpYM.u894ohsRXHVakvnRVkXrLF23RLSjaWVnt7ilOfF1b48ejrwpzpyDtzmvgPFPuDfowf8yHOYr0BH.d08xvGCTq4ywL72VnMmJlnlBrdzi1qtmmg6ux9MMvOSGnF4t+EXlNMWW0qWN3SVJaV1HM72LHY51xfDbmpndXA5jBftG9gOD+fR8RVIZLVpzdrTQOQX.A.d7GJZ73UJKO1bZ7JEqGkEuNCaHRCGQiKeBpUDtqu3.jc1rAH9l1xRJJE8EL0IQzb5dRdfdvf9+KOtAk2WCCdpliP3eprwN2IeryAoJkTfXA50B1RKJKCJOkGsAdvy0bp0rvbmJ2DyZM2rpnW0uKQQziLySBHwhnwJlt94zkdArywL.0ysKM4bkLB43N+pKx4SLg61EiWIBJOOZlFtlnKs4220dlk3MseGKPME7myeAjSorISUZp+AnXJZXw9KucPnqtJu5LOx255hbqRQFGukQ9UWc+rHeQQuCTzJAhZa1wrEH+dRYfzs8l4L6Idoh4m+ewSkKNnfOvSKu9DVbKCR4D0hay0OaIW.bCcgUn50jhDXFU4m0bCVw2bsq32THdO2ALk+zUiwJq.ivUg+OvX9Cits6giGS8UV.Vys2q21WAcMg+WjoJlXxQDULCNrcONMbHzU6SgnKfKKI5N9J5KUF5lZZcEXHUDjQbE7kKrkl1IWXqBgnPher7s9lgO5mdcqLN.lDYuzzCdxKPias7jtP3kfu02eQWsjgew1Z3WtsF9zs0vuZaM7Yaqge81Z32b8Fpen9KSUxPy0FD5nAGlsqvw4PAA5.y5VQ+KvzBcZB
-
Thank you David!
You are awesome!
L
-
Thank you for the code... it is much simpler.
However, using this code leaves the last button activated instead of the first.
Any idea how I can have the first button be activated/highlighted and NOT switch to the last one?
//! pnlTab const pnlTab = Content.getAllComponents("StylesPanel"); //! btnHideAll const btnHideAll = Content.getComponent("SplashScreenTriggerButton"); btnHideAll.setControlCallback(onbtnHideAllControl); inline function onbtnHideAllControl(component, value) { setTabVisibility(); } //! btnTab const btnTab = Content.getAllComponents("Rhythm_Button"); for (x in btnTab) { x.setControlCallback(onbtnTabControl); } inline function onbtnTabControl(component, value) { local index = btnTab.indexOf(component); for (i = 0; i < btnTab.length; i++) btnTab[i].setValue(index == i); setTabVisibility(); } //! Functions inline function setTabVisibility() { for (i = 0; i < btnTab.length; i++) { pnlTab[i].showControl(btnTab[i].getValue() && !btnHideAll.getValue()); } rhythmDisplayid.set("visible", !btnHideAll.getValue()); spashScreenNameID.set("visible", btnHideAll.getValue()); }
-
@larryseyer said in Trigger Panels Off/On via button:
However, using this code leaves the last button activated instead of the first.
Do you mean when you activate the hide all button you want button 0 to be activated?
-
No.
I'll explain further...
The splash screen happens when the program loads.
AND
It happens when the logo button is clicked on.
When program first loads, I want button 1 to be active.
But when the logo button is clicked, I want whatever button was active to return to being active.
-
@larryseyer If the buttons are set to saveInPreset then you should be able to set the first button on, save your project, and when it loads that button will be on by default.
-
I understand that... and it does.
But when I run your code, and click on the logo button, button 4 activates even if button 1 was activated before the logo button was pushed.
I want whatever button was active before to return to being active when the logo is pressed a 2nd time and the splash screen goes away.
Maybe a better way to explain this is I want to 'push' the state of the buttons onto a stack/array and then 'pop' their state after the splash screen goes away.
-
@larryseyer said in Trigger Panels Off/On via button:
But when I run your code, and click on the logo button, button 4 activates even if button 1 was activated before the logo button was pushed.
Is the logo button the one I called btnHideAll?
I'm not seeing either of the other buttons being affected by this
-
No, it's a little more complicated than that.
I just became a Patreon supporter highest tier.
Can I send you a message there with more detailed code?
-
@larryseyer said in Trigger Panels Off/On via button:
Can I send you a message there with more detailed code?
Sure but the less detailed the better, by that I mean anything that isn't need to demonstrate the problem will make it more complicated to solve.