Files
Basalt/docs/objects/Treeview/onSelect.md
Robert Jelic 6bab574e8a Treeview Docs
Added Treeview docs
Improved some stuff in the treeview object
2023-05-01 14:56:16 +02:00

32 lines
660 B
Markdown

## onSelect
### Description
`onSelect(self, node)`
The `onSelect` event is triggered when a node in the Treeview object is clicked by the user. You can use this event to handle user interaction with the Treeview nodes.
### Returns
1. `object` The object in use
### Usage
* Creates a Treeview and handles the onSelect event:
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local treeview = mainFrame:addTreeview()
local rootNode = treeview:getRoot()
local childNode = rootNode:addChild("New Child")
treeview:onSelect(function(self, node)
basalt.debug("Selected node:", node:getText())
end)
basalt.autoUpdate()
```