Skip to content

TabGroup ​

A container that switches between groups of widgets using tabs along the top.

Create with AceGUI:Create("TabGroup"). This is a container; it inherits the Common Widget API and container methods.

Widget type: TabGroup

Methods ​

SetTabs ​

method#
lua
container:SetTabs(tabs)

Set the list of tabs to display along the top and rebuild the tab strip. Each call replaces the previous tab list.

Parameters

ParameterTypeDefaultDescription
tabstableArray of tab descriptor tables. Each entry recognizes value (the value passed to SelectTab / reported by OnGroupSelected when this tab is clicked, required to identify the tab), text (the label shown on the tab), and disabled (if truthy, the tab is drawn greyed out and cannot be clicked).

SelectTab ​

method#
lua
container:SelectTab(value)

Mark the tab whose value matches as selected (and deselect all others). If a matching tab is found, fires OnGroupSelected with that value. The handler is responsible for releasing the previous children and adding the new group's widgets.

Parameters

ParameterTypeDefaultDescription
valuestringThe value of the tab to select.

SetTitle ​

method#
lua
container:SetTitle(text)

Set the title text drawn above the tab strip. Passing nil or "" clears it and tightens the layout. Rebuilds the tabs.

Parameters

ParameterTypeDefaultDescription
textstringTitle string, or nil/"" for none.

SetStatusTable ​

method#
lua
container:SetStatusTable(status)

Supply an external table in which the container stores its state (currently the selected tab value). Use this to persist the selected tab across acquire/release.

Parameters

ParameterTypeDefaultDescription
statustableA table you own and keep alive (asserted to be of type table).

BuildTabs ​

method#
lua
container:BuildTabs()

Recompute the tab strip layout (sizes, rows, anchoring). Called internally by SetTabs/SetTitle/resize; rarely needs to be called directly.

The container also defines CreateTab, OnWidthSet, OnHeightSet, and LayoutFinished as internal layout helpers.

Callbacks ​

OnGroupSelected ​

callback#
lua
OnGroupSelected(value)

Fired by SelectTab (including the tab's own click handler) when a tab matching the given value is selected.

Parameters

ParameterTypeDefaultDescription
valuestringThe selected tab's value.

OnTabEnter ​

callback#
lua
OnTabEnter(value, tabFrame)

Fired when the mouse enters a tab button.

Parameters

ParameterTypeDefaultDescription
valuestringThe tab's value.
tabFrameButtonThe underlying tab Button.

OnTabLeave ​

callback#
lua
OnTabLeave(value, tabFrame)

Fired when the mouse leaves a tab button.

Parameters

ParameterTypeDefaultDescription
valuestringThe tab's value.
tabFrameButtonThe underlying tab Button.

Example ​

lua
local AceGUI = LibStub("AceGUI-3.0")

local tab = AceGUI:Create("TabGroup")
tab:SetTitle("Settings")
tab:SetLayout("Flow")
tab:SetFullWidth(true)

tab:SetTabs({
    { value = "general", text = "General" },
    { value = "audio",   text = "Audio"   },
    { value = "about",   text = "About", disabled = true },
})

tab:SetCallback("OnGroupSelected", function(container, event, group)
    container:ReleaseChildren()
    if group == "general" then
        local cb = AceGUI:Create("CheckBox")
        cb:SetLabel("Enable addon")
        container:AddChild(cb)
    elseif group == "audio" then
        local lbl = AceGUI:Create("Label")
        lbl:SetText("Audio options go here")
        container:AddChild(lbl)
    end
end)

-- select an initial tab (this fires OnGroupSelected)
tab:SelectTab("general")

Ace3, a World of Warcraft addon framework.