ComboItem: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 :

  • A string which represents the path to an ".ico" icon file, or gets the icon associated with the provided file/directory.
  • A Widget object, whose icon will be used by the item.
  • A Directory or File object, representing an ".ico" file, or gets the icon associated with the provided file/directory.
  • A Buffer object, whose binary content will represent the icon.

When no argument or a nil path value is provided, the ComboItem icon will be removed.

[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("TabItem:loadicon() sample", 316, 246) local combo = ui.Combobox(win, {"Disk", "Network", "Search"}, 10, 40) local icons = { 8, 19, 23 } -- set Combobox style property to "icons" to view ComboItems icons combo.style = "icons" -- all icons are in a resources directory for idx, icon in ipairs(icons) do combo.items[idx]:loadicon("shell32.dll", icon) end -- shows the Window win:show() -- update user interface repeat ui.update() until not win.visible