Created
October 13, 2020 19:06
-
-
Save zlovatt/466105163b921690527342e7d2c36166 to your computer and use it in GitHub Desktop.
Example script for creating a listbox via aequery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
// Set path below to your aeq.js path | |
//@include "path/to/aequery.js" | |
function createPanel() { | |
var win = aeq.ui.createWindow("Listbox Test"); | |
var pnl = win.addPanel("List"); | |
pnl.set({ | |
orientation: "row", | |
alignment: ["fill", "fill"], | |
alignChildren: ["fill", "fill"] | |
}); | |
var listbox = pnl.addListBox( | |
["abc", "def", "ghi", "jkl", "mno", "pqr", "stu", "vwx", "yz"], | |
undefined, | |
undefined, | |
{ | |
multiselect: true | |
} | |
); | |
var grpListBoxMeta = pnl.addGroup({ | |
orientation: "column" | |
}); | |
grpListBoxMeta.addButton("+", function () { | |
var userInput = prompt("Type something in...", "Item Name Here"); | |
if (!userInput) { | |
return; | |
} | |
listbox.addItem(userInput); | |
}); | |
grpListBoxMeta.addButton("-", function () { | |
var selectedItems = listbox.getSelection(); | |
if (!selectedItems) { | |
return; | |
} | |
for (var ii = 0, il = selectedItems.length; ii < il; ii++) { | |
var selectedItem = selectedItems[ii]; | |
listbox.removeItem(selectedItem); | |
} | |
}); | |
win.addButton("Close Panel", function () { | |
win.close(); | |
}); | |
win.show(); | |
} | |
createPanel(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment