我正在尝试根据 Photoshop Script UI 复选框的状态更改一些标签文本。只是它根本不更新。不知道为什么。
理想情况下,我希望它在勾选时说“一些文本” ,而在未选中时说“一些其他文本”。并动态变化。
这是我的代码
// DIALOG
// ======
var dlg = new Window("dialog");
dlg.text = "Title";
dlg.preferredSize.width = 180;
dlg.preferredSize.height = 100;
dlg.orientation = "column";
dlg.alignChildren = ["center","top"];
dlg.spacing = 10;
dlg.margins = 16;
var statictext1 = dlg.add("statictext", undefined, undefined, {name: "statictext1"});
statictext1.text = "Some static text";
statictext1.justify = "center";
var checkbox1 = dlg.add("checkbox", undefined, undefined, {name: "checkbox1"});
checkbox1.text = "Some text";
checkbox1.value = true;
// GROUP1
// ======
var group1 = dlg.add("group", undefined, {name: "group1"});
group1.orientation = "row";
group1.alignChildren = ["left","center"];
group1.spacing = 10;
group1.margins = 0;
// add buttons
group1.add ("button", undefined, "OK");
group1.add ("button", undefined, "Cancel");
// Define behavior for when the slider value changes
dlg.checkbox1.onChanging = function()
{
var textArr = ["Some text", "Some other text"]
var val = dlg.checkbox1.value;
// Update the label text with the current checkbox value.
dlg.checkbox1.text = textArr[val];
}
var myReturn = dlg.show();