I want to alert all col2.text even col2 text has been changed but without scroll the scrollbar, but I can only alert
"Alpha", "Bravo", "Charlie", Delta", "Echo", "Foxtrot", Golf", "Hotel", India", "Juliet"
How can alert all?
var call_codes = {"A": "Alpha", "B": "Bravo", "C": "Charlie", "D": "Delta", "E": "Echo", "F": "Foxtrot", "G": "Golf", "H": "Hotel", "I": "India",
"J": "Juliet", "K": "Kilo", "L": "Lima", "M": "Mike", "N": "November", "O": "Oscar", "P": "Papa", "Q": "Quebec", "R": "Romeo", "S": "Sierra", "T":
"Tango", "U": "Uniform", "V": "Victor", "W": "Whiskey", "X": "X-ray", "Y": "Yankee", "Z": "Zulu"};
var rows = 10, number_of_codes = 0;
for (var i in call_codes) number_of_codes++; // We need to know how many elements the object contains
alert(number_of_codes);
var w = new Window ("dialog");
var group = w.add ("group {alignChildren: 'fill'}");
var panel = group.add ("panel {orientation: 'row', alignChildren: 'top'}");
var sbar = group.add ("scrollbar {preferredSize: [20, undefined], maxvalue: " + String (number_of_codes-rows) + "}");
var col1 = panel.add ("group {orientation: 'column', margins: 3}");
var col2 = panel.add ("group {orientation: 'column', alignChildren: 'fill', preferredSize: [150, undefined]}");
myText1Array =[];
var fields = {}, start = 0, stop = rows, n = -1, myCheck = {};
for (var i in call_codes){
++n;
if (n >= start && n < stop){
myCheck[n] =col1.add ("statictext", [0, 0, 20, 22], i);
fields[n] = col2.add ("edittext", undefined, call_codes[i]);
fields[n].label = i; // Add a label property that contains the letter
fields[n].onChange = function () {call_codes[this.label] = this.text}
} // When the edittext is changed, update the call_codes object
}
sbar.onChanging = function()
{
myTextArray = [];
var start = Math.round (this.value); // Round the sbar's value
var stop = start+rows, n = 0, r = -1;
for (var i in call_codes)
{
n++;
if (n > start && n <= stop)
{
++r;
col1.children[r].text = i; // Replace the contents of the statictext
fields[r].text = call_codes[i]; // and the edittext controls
fields[r].label = i; // and update each edittext's label
}
}
}
w.show();
for (var i=0; i<26; i++){
alert(col2.children[i].text);
}