Skip to content

EmuTabGroup

Michael edited this page Jun 11, 2020 · 6 revisions

You can create tabbed groups of UI elements with an EmuTabGroup. Tabs act as containers for other UI elements, with exactly one tab open at any given time.

Constructor

Inheritance: EmuCore

EmuTabGroup(x, y, width, height, rows, row_height)
Parameter Type Description
x real The x coordinate where the tab group will be created
y real The y coordinate where the tab group will be created
w real The width of the tab group
h real The height of the tab group
rows real The number of rows of tabs in the tab group
row_height real The height of each tab row; each tab row will be the same height

When creating a tab group, you specify the number of rows of tabs (1 is fine, but you can have as many as you want) and the height of each tab row. Tabs in a row expand to fill their horizontal space, and they each have the same vertical height.

Relevant Methods

EmuTabGroup::AddTabs(row, tabs)

Returns: N/A

Parameter Type Description
row real The index of the row to add the tab(s) to
tab EmuTab The tab(s) you wish to add to the row

Use this to add tabs to the tab group. This may be a single tab, or an array of tabs. If you give it an array, all of the elements will be added. Tab rows are zero-indexed.

By default, the first tab added will be activated.

EmuTabGroup::RequestActivateTab(tab)

Returns: N/A

Parameter Type Description
tab EmuTab The tab(s) you wish to add to the row

Use this to activate a tab, making its contents visible and hiding the previously active tab. The tab must be included in the tab group.

Example

var group = new EmuTabGroup(0, u, 640, 640, 2, 32);
var tab_inv = new EmuTab("Inventory");
var tab_com = new EmuTab("Combat");
var tab_rs = new EmuTab("Relationships");
var tab_dg = new EmuTab("Dialogue");
var tab_ai = new EmuTab("AI");
group.AddTabs(0, [tab_inv, tab_com, tab_rs]);
group.AddTabs(1, [tab_dg, tab_ai]);

container.AddContent(group);

This will create an EmuTabGroup and populate it with five tabs in two rows, and then add it to a previously defined container.