I have an ini file with something like the following:
[tweaks]
Tweak 1=tweak1.bat
Tweak 2=tweak2.bat
Tweak 3=tweak3.bat
I can read it easily enough with:
local $tweaks = IniReadSection(@ScriptDir & "\bats\tweakit.ini","Tweaks")
I would like to create an array of checkboxes using the above data. Actually, an array of arrays, where each item has an array of the checkbox id and the action. Something like this:
local $cb = [[GUICtrlCreateCheckbox(…),'doit1'],[GUICtrlCreateCheckbox(…),'doit2],…]
only generated dynamically.
From here on, I am lost because the error messages I get are not very informative.
To begin with, I have:
local $checkboxes[$values[0][0]]
for $i = 1 to $values[0][0]
local $cb = [GUICtrlCreateCheckbox($values[$i][0], 20, 80+$i*20),$values[$i][1]]
; how do I add to the array?
next
; event loop …
; process checked items
for $i=0 to ubound($checkboxes)-1
MsgBox($MB_SYSTEMMODAL, "CB", $checkboxes[$i][0]) ; checkbox resource
MsgBox($MB_SYSTEMMODAL, "CB", $checkboxes[$i][1]) ; checkbox action
next
How can I add the checkboxes to the array so that the processing loop above works?
I thought I could do this:
local $cb = [GUICtrlCreateCheckbox($values[$i][0], 20, 80+$i*20),$values[$i][1]]
$checkboxes[$i-1] = $cb
next
which I thought would create a nested array, but when I check $checkboxes[1][0]
and $checkboxes[1][1]
I see that that isn’t the case.
Aucun commentaire:
Enregistrer un commentaire