Answered
Removing items from the drop-down list
Hello guys! How do I remove the selected item from a drop-down list?
Here is a small script with an example, I don't understand why it doesn't work. Grateful for the help.
var dlg = new Window("dialog");
var conteudo = ["Item 1","Item 2","Item 3","Item 4","Item 4","Item 4","Item 4","Item 4","Item 4"];
var list = dlg.add("dropdownlist", undefined, undefined, {name: "list", items: conteudo});
list.selection= 0;
var remove = dlg.add("button", undefined, undefined, {name: "remove"}); remove.text="Remove ítem"
remove.onClick = function () {
for (var i = list.selection.length-1; i > -1; i--)
list.remove (list.selection[i]);
}
dlg.show();
