2.4 KiB
2.4 KiB
TabControl
The TabControl is a container that provides tabbed interface functionality
Extends: Container
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| activeTab | number | The | currently active tab ID |
| tabHeight | number | Height | of the tab header area |
| tabs | table | List | of tab definitions |
| headerBackground | color | Background | color for the tab header area |
| activeTabBackground | color | Background | color for the active tab |
| activeTabTextColor | color | Foreground | color for the active tab text |
| scrollableTab | boolean | false | Enables scroll mode for tabs if they exceed width |
| tabScrollOffset | number | 0 | Current scroll offset for tabs in scrollable mode |
Functions
| Method | Returns | Description |
|---|---|---|
| TabControl:newTab | table | Creates a new tab handler proxy |
| TabControl:setTab | TabControl | Sets an element to belong to a specific tab |
| TabControl:addElement | table | Adds an element to the TabControl and assigns it to the active tab |
| TabControl:setActiveTab | - | Sets the active tab |
| TabControl:scrollTabs | TabControl | Scrolls the tab header left or right if scrollableTab is enabled |
| TabControl:setCursor | - | Sets the cursor position; accounts for tab header offset when delegating to parent |
TabControl:newTab(title)
returns a proxy for adding elements to the tab
Parameters
titlestringThe title of the tab
Returns
tabletabHandlerThe tab handler proxy for adding elements to the new tab
TabControl:setTab(element, tabId)
Parameters
elementtableThe element to assign to a tabtabIdnumberThe ID of the tab to assign the element to
Returns
TabControlselfFor method chaining
TabControl:addElement(elementType, tabId)
Parameters
elementTypestringThe type of element to addtabIdnumberOptional tab ID, defaults to active tab
Returns
tableelementThe created element
TabControl:setActiveTab(tabId)
Parameters
tabIdnumberThe ID of the tab to activate
TabControl:scrollTabs(direction)
Scrolls the tab header left or right if scrollableTab is enabled
Parameters
directionnumber-1 to scroll left, 1 to scroll right
Returns
TabControlselfFor method chaining