Try this:
win.projectList = [];
for (...) {
var cb = win.add(...);
win.projectList.push(cb);
}
سؤال
I'm trying to build a simple interface with a list populated by an array. My proplem is I don't know how to make the a variable number of "projectList"
I've tried the following
var win = new Window('palette', 'Character Importer', undefined, {resizeable:true});
var w = buildUI();
w.show();
//build UI
function buildUI(){
if (win != null) {
for(i=0; i<lines.length; i++) {
win.projectList = win.add ("checkbox", undefined, charNames[i]);
win.projectList.alignment = ['left','center'];
}
But win.projectList only contains the value for the last name, I understand it's becuase I keep duplicating it. How can I create new properties? I've tried adding a [i] after projectList with no luck.
Thanks in advance
المحلول
Try this:
win.projectList = [];
for (...) {
var cb = win.add(...);
win.projectList.push(cb);
}