2.00 Tabs
Lokasenna edited this page Jun 24, 2018
·
1 revision
Provides a set of tabs that swap between different sets of z-layers, allowing for a tabbed view.
z Element depth, used for hiding and disabling layers. 1 is the highest.
x, y Coordinates of top-left corner
tab_w, tab_h Size of individual tabs
opts Comma-separated string, or a table, of tab names
pad Padding between tabs. Defaults to 8.
w, h Overall width and height of the tab strip. These are determined
automatically based on the number of tabs and their size.
bg Color to be drawn underneath the tabs. Defaults to "elm_bg".
col_txt Text color. Defaults to "txt".
col_tab_a Active tab color. Defaults to "wnd_bg"
col_tab_b Inactive tab color. Defaults to "tab_bg"
font_a Active tab font. Defaults to 3.
font_b Inactive tab font. Defaults to 4.
fullwidth Boolean. Extends the tab background to the right edge of the script window.
Defaults to true.
state The current tab. Numbered from left to right, starting at 1.
Returns the active tab. Numbered from 1.
Sets the active tab. Numbered from 1.
Assigns the z layers that are shown for each tab. Sets are defined thusly:
(Only needs to be done once, at startup)
GUI.elms.my_tabs:update_sets(
{
z-layers shown on that tab
tab /
/ |
| |
v v
[1] = {2, 3, 4},
[2] = {2, 5, 6},
[3] = {2, 7, 8},
}
)
update_sets() will be called automatically when a tab is clicked, or if a new tab is set using GUI.Val.
- z-layers not included in any set (1, in the example above) will always be active unless frozen/hidden manually
- z-layers in multiple sets (2, above) will be active on all of those tabs
- Elements can have their z changed at any time - handy if you want to hide specific bits rather than the whole layer. Make sure to redraw any appropriate layers afterward
- Likewise, the sets can be changed atany time by calling update_sets() with a new layer table
Introduction
- 1. Getting started
- 2. Parts of a basic script
- 3. How it works
- 4. Fonts and colors
- 5. Element methods
Elements
- 1. Button
- 2. Frame
- 3. Knob
- 4. Label
- 5. Listbox
- 6. Menubar
- 7. Menubox
- 8. Options
- 9. Slider
- 10. Tabs
- 11. Textbox
- 12. TextEditor
- 13. Window
Core functions
- 1. Element creation
- 2. GUI variables
- 3. Script hooks
- 4. Table functions
- 5. Text functions
- 6. Color functions
- 7. Math and Logic functions
- 8. Graphics functions
- 9. Element functions
Additional documentation