Copy link to clipboard
Copied
I found this discussion very interesting and useful
Re: change opacity levels individually
I wanted to know if you could add a reset button
To reset the sliders.
Yes, you can reset a slider in a UI or say on the opacity level of a layer. For the layer, you would have to get the scriptlistener code for changing the opacity and apply that to your UI script. Here's a sample on doing it with a slider within a script UI:
...var sDefault = 34;
var dlg = new Window('dialog','Slider Test');
var sdr = dlg.add('slider',undefined,34,0,100);
sdr.size = [400,30];
var txt = dlg.add('statictext',undefined,sdr.value);
var btn = dlg.add('button',undefined,'Reset Slider');
Copy link to clipboard
Copied
Yes, you can reset a slider in a UI or say on the opacity level of a layer. For the layer, you would have to get the scriptlistener code for changing the opacity and apply that to your UI script. Here's a sample on doing it with a slider within a script UI:
var sDefault = 34;
var dlg = new Window('dialog','Slider Test');
var sdr = dlg.add('slider',undefined,34,0,100);
sdr.size = [400,30];
var txt = dlg.add('statictext',undefined,sdr.value);
var btn = dlg.add('button',undefined,'Reset Slider');
sdr.onChanging = function(){txt.text = sdr.value}
btn.onClick = function(){
sdr.value = sDefault;
txt.text = sdr.value;
}
dlg.show()