I think there are at least two ways to do something like this. One way would be to give the controls names. You can then find them by name. var par = Array("Select your choise","test 1","test 2", "test 3"); var rez = ask(par); if( rez == 1) alert(wask.findElement('rb1').value); function ask(par){ wask = new Window('dialog', ''); wask.orientation = "column"; wask.alignment="top"; wask.spacing=0; grs0 =wask.add('group'); grs0.spacing=0; grs0.add('statictext', undefined, par[0]); grs0.alignment="top"; grs0.preferredSize.height = 40; grs1 =wask.add('group'); grs1.spacing=0; grs1.alignment="left"; grs1.preferredSize.height = 20*par.length; grs1.orientation = "column"; for(var i=1;i<par.length;i++){ r = grs1.add("radiobutton", undefined, par,{name:'rb'+i}); r.alignment="left"; } bt1 = wask.add ("button", undefined, "Select",{name:'ok'}); bt2 = wask.add ("button", undefined, "Close",{name:'cancel'}); return wask.show(); } Another way would be to use an eval statement in the loop that creates the controls. Something like var par = Array("Select your choise","test 1","test 2", "test 3"); var rez = ask(par); if( rez == 1) alert(wask.rb1.value); function ask(par){ wask = new Window('dialog', ''); wask.orientation = "column"; wask.alignment="top"; wask.spacing=0; grs0 =wask.add('group'); grs0.spacing=0; grs0.add('statictext', undefined, par[0]); grs0.alignment="top"; grs0.preferredSize.height = 40; grs1 =wask.add('group'); grs1.spacing=0; grs1.alignment="left"; grs1.preferredSize.height = 20*par.length; grs1.orientation = "column"; for(var i=1;i<par.length;i++){ eval('wask.rb'+i+' = grs1.add("radiobutton", undefined, par['+i+']);'); eval('wask.rb'+i+'.alignment="left";'); } bt1 = wask.add ("button", undefined, "Select",{name:'ok'}); bt2 = wask.add ("button", undefined, "Close",{name:'cancel'}); return wask.show(); }
... View more