I'd like to show and hide a panel using a button
-
I've figured out how to get the console to print the 1 or 0 value of a button, but I don't know how to translate that to the pop up showing or not. Should I use if else for this? How do I get the panel to show and hide?
-
@pgaudioworks MyPanel.showControl(MyButton.getValue);
-
@d-healey thank you David. I'm getting this error:
Draft 1:! Line 7, column 22: API call with undefined parameter 0 {SW50ZXJmYWNlfG9uSW5pdCgpfDE3M3w3fDIy}
Here's what I have:
const var Panel1Red = Content.getComponent("Panel1Red"); const var Button1 = Content.getComponent("Button1"); Panel1Red.showControl(Button1.getValue);
-
@pgaudioworks try with a callback.
inline function onButton1Control(component, value) { Panel1Red.showControl(value); }; Content.getComponent("Button1").setControlCallback(onButton1Control);
-
@CyberGen That definitely worked, but I don't think I understand why.
Is the first line creating an inline function that happens whenever the button is pressed? And the contents of the { } is the what the inline function does when it's run? I don't understand the last line at all.
Am I close?
-
@pgaudioworks yes, go watch my Scripting 101 video
-
-
@pgaudioworks said in I'd like to show and hide a panel using a button:
@d-healey thank you David. I'm getting this error:
Draft 1:! Line 7, column 22: API call with undefined parameter 0 {SW50ZXJmYWNlfG9uSW5pdCgpfDE3M3w3fDIy}
Here's what I have:
const var Panel1Red = Content.getComponent("Panel1Red"); const var Button1 = Content.getComponent("Button1"); Panel1Red.showControl(Button1.getValue);
nearly...
Panel1Red.showControl(Button1.getValue());
..see those extra ellipses at the end of getValue() ??