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

31 lines
1.0 KiB
Markdown

## setOffset
### Description
Returns the current x and y offset values for the Treeview object. These values determine the indentation of the nodes within the TreeView object on both axes.
### Returns
1. `number` The current x offset value of the Treeview object.
2. `number` The current y offset value of the Treeview object.
### Usage
* Creates a Treeview, sets the x and y offsets, and retrieves the current offset values:
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local treeview = mainFrame:addTreeview()
:setOffset(2, 3)
local offsetX, offsetY = treeview:getOffset()
basalt.debug("Treeview x offset:", offsetX)
basalt.debug("Treeview y offset:", offsetY)
basalt.autoUpdate()
```
In this example, a Treeview object is created and added to the mainFrame. The `setOffset` method is used to set the x and y indentation of the nodes within the TreeView object to 2 pixels and 3 pixels, respectively. The `getOffset` method is then called to retrieve the current x and y offset values, which are printed to the debug console.