-
How to close a ScriptUI element?
Hello,
I’ve searched everywhere on the internet regarding this, but found nothing at all…
I have this little script that when you launch it it has a button… when you click it, another one pops below it.
I want every generated button to disappear on click. So far I’ve got it to “hide” … which is not the same, because if I make one, hide it and make another one… it will appear in the place of the second generated button… since the first one stays there, its just hidden.I hope you understood my question…
Thanks for being such an amazing community.
var myWin = new Window("palette", "Window", undefined,);
var run = myWin.add("button", undefined, "MakeButton");run.onClick = function(){ //activate on click
var btn = myWin.add("button", [0,0,30,30] , 'Hide'); //the new button
btn.onClick = function(){btn.hide()}; //the action of the new buttonmyWin.layout.layout(true);
myWin.show();}
myWin.center();
myWin.show();