Hello again, I did a bit more digging and still do not have a solution, but narrowed down the issue. It appears that the dropdown list resets itself when the onChange function affects something outside the palette, like triggering an alert or changing something in After Effects. However, it works correctly when the onChange function affects the palette itself, like checking a box. At the bottom of the post, I pasted the code for an updated script that demonstrates the issue. It has 3 dropdown lists: One does nothing. The second triggers an alert, which behaves incorrectly and resets itself when it shouldn’t. The third checks/unchecks boxes and behaves correctly. Hopefully someone from Adobe can replicate the issue and confirm it's a bug. Thank you. var panelGlobal = this;
// DIALOG
// ======
var dialog = (panelGlobal instanceof Panel) ? panelGlobal : new Window("palette");
if ( !(panelGlobal instanceof Panel) ) dialog.text = "Dropdown Test";
dialog.orientation = "row";
dialog.alignChildren = ["center","top"];
dialog.spacing = 10;
dialog.margins = 16;
// PANEL_DONOTHING
// ===============
var panel_DoNothing = dialog.add("panel", undefined, undefined, {name: "panel_DoNothing"});
panel_DoNothing.text = "Do Nothing";
panel_DoNothing.orientation = "column";
panel_DoNothing.alignChildren = ["left","top"];
panel_DoNothing.spacing = 10;
panel_DoNothing.margins = 10;
var dd_DoNothing_array = ["Item 1","Item 2","Item 3"];
var dd_DoNothing = panel_DoNothing.add("dropdownlist", undefined, undefined, {name: "dd_DoNothing", items: dd_DoNothing_array});
dd_DoNothing.selection = 0;
// PANEL_ALERT
// ===========
var panel_Alert = dialog.add("panel", undefined, undefined, {name: "panel_Alert"});
panel_Alert.text = "Alert";
panel_Alert.orientation = "column";
panel_Alert.alignChildren = ["left","top"];
panel_Alert.spacing = 10;
panel_Alert.margins = 10;
var dd_Alert_array = ["Item 1","Item 2","Item 3"];
var dd_Alert = panel_Alert.add("dropdownlist", undefined, undefined, {name: "dd_Alert", items: dd_Alert_array});
dd_Alert.selection = 0;
// PANEL_CHECKBOX
// ==============
var panel_Checkbox = dialog.add("panel", undefined, undefined, {name: "panel_Checkbox"});
panel_Checkbox.text = "Check boxes";
panel_Checkbox.orientation = "column";
panel_Checkbox.alignChildren = ["center","top"];
panel_Checkbox.spacing = 10;
panel_Checkbox.margins = 10;
// GRP_CHECKBOXES
// ==============
var grp_Checkboxes = panel_Checkbox.add("group", undefined, {name: "grp_Checkboxes"});
grp_Checkboxes.orientation = "row";
grp_Checkboxes.alignChildren = ["left","center"];
grp_Checkboxes.spacing = 17;
grp_Checkboxes.margins = 0;
var checkbox1 = grp_Checkboxes.add("checkbox", undefined, undefined, {name: "checkbox1"});
checkbox1.text = "1";
var checkbox2 = grp_Checkboxes.add("checkbox", undefined, undefined, {name: "checkbox2"});
checkbox2.text = "2";
var checkbox3 = grp_Checkboxes.add("checkbox", undefined, undefined, {name: "checkbox3"});
checkbox3.text = "3";
var dd_Checkboxes_array = ["Box 1","Box 2","Box 3"];
var dd_Checkboxes = panel_Checkbox.add("dropdownlist", undefined, undefined, {name: "dd_Checkboxes", items: dd_Checkboxes_array});
dd_Checkboxes.selection = 0;
dialog.layout.layout(true);
dialog.layout.resize();
dialog.onResizing = dialog.onResize = function () { this.layout.resize(); }
if ( dialog instanceof Window ) dialog.show();
//Test dropdown list by showing alert
dd_Alert.onChange = function () {
alert("Dropdown 2 - TEST!!\nDoes the list clear after clicking OK?");
}
//Test dropdown list by checking/unchecking boxes in palette
dd_Checkboxes.onChange = function () {
var listNum = dd_Checkboxes.selection.index;
switch(listNum){
case 0:
(checkbox1.value) ? checkbox1.value = false : checkbox1.value = true;
break;
case 1:
(checkbox2.value) ? checkbox2.value = false : checkbox2.value = true;
break;
case 2:
(checkbox3.value) ? checkbox3.value = false : checkbox3.value = true;
break;
}
}
... View more