This commit is contained in:
NoryiE
2025-10-29 08:11:09 +00:00
parent f798a698b3
commit 9a5b46138e
2 changed files with 51 additions and 0 deletions

View File

@@ -27,6 +27,9 @@ Extends: `VisualElement`
|[Collection:clear](#collection-clear)|Collection|Clears all items from the Collection|
|[Collection:getSelectedItems](#collection-getselecteditems)|table|Gets the currently selected items|
|[Collection:getSelectedItem](#collection-getselecteditem)|selected|Gets first selected item|
|[Collection:getSelectedIndex](#collection-getselectedindex)|index|Gets the index of the first selected item|
|[Collection:selectNext](#collection-selectnext)|Collection|Selects the next item|
|[Collection:selectPrevious](#collection-selectprevious)|Collection|Selects the previous item|
|[Collection:onSelect](#collection-onselect-callback)|Collection|Registers a callback for the select event|
## Collection:addItem(text)
@@ -91,6 +94,32 @@ Gets first selected item
### Returns
* `selected` `The` first item
## Collection:getSelectedIndex()
Gets the index of the first selected item
### Returns
* `index` `The` index of the first selected item, or nil if none selected
### Usage
```lua
local index = Collection:getSelectedIndex()
```
## Collection:selectNext()
Selects the next item in the collection
### Returns
* `Collection` `self` The Collection instance
## Collection:selectPrevious()
Selects the previous item in the collection
### Returns
* `Collection` `self` The Collection instance
## Collection:onSelect(callback)
Registers a callback for the select event