In this example, we created a tab object with three tab buttons ('tab1', 'tab2', 'tab3'). You may add UI objects to each tab separately, and these objects will be layed vertically because each tab has a Vertical Layout by default.
Tab constructor takes two optional parameters:
var tab = new TTab(margin, padding);
Tab Methods
| Method | Description |
|---|---|
| addTab | Adds new tab button to the tab object: tab.addTab(id, title, alignment); Here the alignment will affect all UI objects within this tab |
| addTabItem | Adds UI object to specific tab by Id: tab.addTabItem(tabId, object); |
| alignCenter | Positions tab buttons to the center. By default tab buttons have left align |
| alignLeft | Positions tab buttons to the left which is the default align |
| alignRight | Positions tab buttons to the right. By default tab buttons have left align |
| getSelectedTabName | Gets selected tab id (the currently opened tab id) |
| setDirection | Sets direction from left to right (ltr) or from right to left (rtl) |
| setOnSelectedTabChanged | Sets an event handler to the selected tab changed event: tab.setOnSelectedTabChanged(function() { doSomething(); }); |
| setSelectedTabName | Sets the default selected tab: tab.setSelectedTabName('tab2'); |