Multiple different ways how you can do this.
You can use different methods of collecting the results, you can use XPath
Names Default To Here(1);
fruits = {"apple", "banana", "orange"};
value_collector = V List Box(
Text Box("Enter the values"),
lub = Lineup Box(N Col(2))
);
For Each({fruit}, fruits,
lub << append(Text Box(fruit));
lub << append(Number Edit Box(42));
);
nw = New Window("Enter Numbers", <<Modal, <<Return Result,
V List Box(
value_collector,
H List Box(
Button Box("OK",
vals = (lub << XPath("//NumberEditBox")) << get;
),
Button Box("Cancel")
)
)
);
If(nw["Button"] != 1,
Throw("Cancelled")
);
Show(fruits, vals);
or store the references to a list
Names Default To Here(1);
fruits = {"apple", "banana", "orange"};
value_collector = V List Box(
Text Box("Enter the values"),
lub = Lineup Box(N Col(2))
);
nebs = {};
For Each({fruit}, fruits,
lub << append(Text Box(fruit));
lub << append(neb = Number Edit Box(42));
Insert Into(nebs, neb);
);
nw = New Window("Enter Numbers", <<Modal, <<Return Result,
V List Box(
value_collector,
H List Box(
Button Box("OK",
vals = nebs << get;
),
Button Box("Cancel")
)
)
);
If(nw["Button"] != 1,
Throw("Cancelled")
);
Show(fruits, vals);
or associative array
Names Default To Here(1);
fruits = {"apple", "banana", "orange"};
value_collector = V List Box(
Text Box("Enter the values"),
lub = Lineup Box(N Col(2))
);
vals = Associative Array();
For Each({fruit}, fruits,
lub << append(Text Box(fruit));
lub << append(neb = Number Edit Box(42));
vals[fruit] = neb;
);
nw = New Window("Enter Numbers", <<Modal, <<Return Result,
V List Box(
value_collector,
H List Box(
Button Box("OK",
res = Associative Array(vals << get keys, (vals << get values) << get);
),
Button Box("Cancel")
)
)
);
If(nw["Button"] != 1,
Throw("Cancelled")
);
Show(fruits, vals, res);
With these you will have UI something like this
Or you could utilize totally different display box elements (table box and number col edit box)
Names Default To Here(1);
fruits = {"apple", "banana", "orange"};
nw = New Window("Enter Numbers", <<Modal, <<Return Result,
V List Box(
Text Box("Enter the values:"),
Table Box(
String Col Box("Fruit", fruits),
nceb = Number Col Edit Box("Value", J(N Items(fruits), 1, 42)),
),
H List Box(
Button Box("OK"),
Button Box("Cancel")
)
)
);
If(nw["Button"] != 1,
Throw("Cancelled")
);
show(nw["nceb"]);
-Jarmo