List.items read/write property iterable
Provides access to the List items.
Reading this property returns a table that contains a list of ListItem. This table can be indexed by item index or by item text. The item position starts from 1. Using a wrong index or an invalid text will return a nil value.
Setting this property will change all the items in the List. It expects a table that contains a list of strings (each string will be an item in the List)
Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("ListItem:loadicon() sample", 316, 246)
local list = ui.List(win, {"Disk", "Network", "Search"}, 10, 40, 120)
local icons = { Disk = 8, Network = 19, Search = 23 }
-- set List style property to "icons" to view ListItems icons
list.style = "icons"
-- all icons are in a resources directory
for item, icon in pairs(icons) do
list.items[item]:loadicon("shell32.dll", icon)
end
-- shows the Window
win:show()
-- update user interface
repeat
ui.update()
until not win.visible