When no argument or a
nil
path value is provided, the ListItem icon will be removed.ListItem:loadicon(path, [index]) method
Loads an item icon, displayed to the left of the item's text.
Parameters
path
Represent any of the following possible icon locations :
[index]
The icon index, an optional number starting from 1, that represent the icon to select.
Return value
The method return a boolean value, indicating wether the operation succeeded or not.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