Replace image in UI
Hi guys.
I am building (trying to) custom checkbox. For that I have two images: imgON and imgOFF that represent the checkbox value - if checkbox is ON the imgON is displayed, if checkbox is OFF imgOFF is displayed.
But I cannot figure out how to switch those images, once user press the button (checkbox), any ideas?
var win = new Window("palette", "Settings", undefined);
var imgON = "/Users/renderTom/Desktop/Custom\ Checkbox/checkON.jpg";
var imgOFF = "/Users/renderTom/Desktop/Custom\ Checkbox/checkOFF.jpg";
var button = win.add("iconbutton", undefined, ScriptUI.newImage(imgON, undefined, imgOFF, imgON), {style:'toolbutton'});
win.show();
button.onClick = function() {
// if current button is imgON -> change it to imgOFF
// if current button is imgOFF -> change it to imgON
}
Thanks in advance,
