Well, here's one where i passed an array, containing
strings to a script:
let's say:
["option 1","option 2","option 3"] exec "scriptname.sqs"
_ok = createDialog "DIALOG1"
?(!_ok): hint "Fehler!"; exit
_array = _this
_max = count _array
_i = 0
#loop
_option = _array select _i
_item = format ["Item" + "%1",_i]
_index = lbAdd [104, _option]
lbSetData [104, _index, _item]
_i = _i + 1
?(_i < _max): goto "loop"
lbSetCurSel [104, 0]
how it work:
_array = _this select 0
that means: _array = ["option 1","option 2","option 3"]
_max = count _array
that means: _max = 3 (as _array consists of 3 strings)
_i = 0
#loop
nothing to add here
now the main part - building the combo contents:
_option = _array select _i
that means: _option = _array select 0 (as _i is 0 atm)
ergo: _option = "option 1"
_item = format ["Item" + "%1",_i]
that means: _item = "Item" + 0 = "Item0" (note: _i is still 0)
_index = lbAdd [104, _option]
lbSetData [104, _index, _item]
this will make "option 1" become the first option of the combo box
:note - my combo box is idc: 104
first line assigns "option 1" for idc 104, second line
makes it to be the first entry of the combo box
_i = _i + 1
?(_i < _max): goto "loop"
that means: _i = 0 + 1 (= 1)
and if _i (1) < _max (3) then goto "loop"
This will make the combo box look like:
option 1
option 2
option 3
and the last line:
lbSetCurSel [104, 0]
will make entry 0 ("option 1") to be selected in the combo box
by default
:note lbSetCurSel [104, 1] would select "option 2" to be default.
hope this helps instead of confuses ;D
~S~ CD