FreeER Grandmaster Cheater Supreme Reputation: 53 Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun Mar 04, 2018 6:09 am Post subject: |
|
|
Code: | for i = 0,i<count-1, i+1 do | this is not how lua for loops work Code: | for i=0,list1.Count-1 -- or count-1 if stored, optionally with ",1" at the end to explicitly show that it's i=i+1 |
Second, Selected is an array of booleans on the listbox (and yeah, that's how Pascal/Lazarus TListBox works...), .Items[whatever] is just a string because Items gives you access to the underlying stringlist of items. So a working example:
Code: | if not UDF1 or false then
UDF1 = createForm()
list1 = createListBox(UDF1)
list1.Items.setText("1\n2\n3\n4\n")
list1.MultiSelect = true
list2 = createListBox(UDF1)
list2.Top = list1.Height
end
count = list1.Items.Count
for i = 0,count-1 do
if list1.Selected[i] then
list2.items.Add(list1.items[i])
else
--print(list1.Items[i],'not selected')
end
end
|
_________________ https://github.com/FreeER/ has a few CE related repos
|
|