ListBox

A widget used to display a list of items. It allows users to view a collection of items arranged in a list format within an application. Each item in the list can contain text and/or icons. This widget provides functionalities to add, remove, select, and manipulate items in the list, making it a versatile tool for presenting and managing lists of information or options in an interface.

local list = ListBox(data: optional)

Properties

setOnItemSelect(callback)

The function when an item is selected

Params:

self, text and index

setItemViewMode(callback)

Sets how items are displayed in the widget: Available options: icons and list

setItems(data: table)

Sets data to the widget. Use the following format: {'item 1', 'item 2', 'item 3', ...}

addImageItem(data: table)

Add an item with an icon alongside it. Use the following format: {'limekit', images('lua.png')}

addImageItems(data: table)

Same as above method, only acceptng build data. Use the following format: {{'limekit', images('lua.png')}, {'apple', images('icon.png')}, ...}

addItem(text)

Adds a single item to the widget

removeItem(row)

Adds a single item to the widget

getCurrentRow(text)

Returns row of selected item

getText()

Returns selected item’s text

getinsertItemAtText(row, text)

Inserts an item at a specified row

setAltRowColors()

Sets alternating colors to the rows

setIconSizes(width, height)

Sets icons to a specified sizes

getTextAt(row)

Gets text at a specified row

getItemsCount()

Returns total items available

clear()

Removes all item in the list

setAllowDragDrop(enable: bool)

Enables or disables dragging and dropping of items

setDragEnabled(enable: bool)

Enables or disables drag