Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

ListItem.selected reports wrong values in DropDownList.onChange

$
0
0

There's a bug in PS CS5 or later (still present in CC, not in CS2) with ListItem.selected property. It is not set correctly when accessed in its drop down list's onChange event. However, ListItem.selection works.

 

This code shows an empty panel (while it shouldn't):

 

var dialog = new Window("dialog", "ListItem.selected bug");
dialog.orientation = "column";

dialog.ddl = dialog.add("dropdownlist", undefined, ["A", "B", "C"]);
dialog.ddl.preferredSize = [40, 20];
dialog.panel = dialog.add("panel", undefined, "Options:");
dialog.panel.preferredSize = [200, 100];
dialog.panel.orientation = "stack";

var options = new Array();
var texts = ["This is A", "This is B", "This is C"];
for (var i = 0; i < dialog.ddl.items.length; ++i) {     var itemOpts = dialog.panel.add("statictext", undefined, texts[i]);     options.push(itemOpts);
}

dialog.ddl.onChange = function() {
     for (var i = 0; i < options.length; ++i) {          if (this.items[i].selected) {               options[i].show();          }          else {               options[i].hide();          }     }
};

dialog.ddl.selection = 0;

dialog.center();
dialog.show();
 

 

I reported this to official channels. It would be nice if you backed it up:

 

JS Scripting: ListItem.selected bug in onChange


Viewing all articles
Browse latest Browse all 27456

Trending Articles