Skip to content

DropdownGroup

A container that switches between groups of widgets using a dropdown at the top.

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

Widget type: DropdownGroup

Note: although this file is named AceGUIContainer-DropDownGroup.lua, the registered widget type is DropdownGroup (lowercase "down"). Use that exact string with AceGUI:Create.

Methods

SetGroupList

method#
lua
container:SetGroupList(list, order?)

Populate the dropdown that selects between groups. The arguments are forwarded directly to the internal Dropdown's SetList.

Parameters

ParameterTypeDefaultDescription
listtableTable mapping each group's value to its display text ([value] = text).
order (optional)tableArray of values defining the display order of the entries.

SetGroup

method#
lua
container:SetGroup(group)

Select a group programmatically by setting the dropdown value, recording it in the status table, and firing OnGroupSelected.

Parameters

ParameterTypeDefaultDescription
groupstringThe value (key from list) of the group to select.

SetTitle

method#
lua
container:SetTitle(title)

Set the title text. With a non-empty title, the dropdown is anchored to the top-right; with an empty title, it is anchored to the top-left.

Parameters

ParameterTypeDefaultDescription
titlestringTitle string, or "" for none.

SetDropdownWidth

method#
lua
container:SetDropdownWidth(width)

Set the width of the dropdown selector (defaults to 200 pixels on acquire).

Parameters

ParameterTypeDefaultDescription
widthnumberWidth in pixels.

SetStatusTable

method#
lua
container:SetStatusTable(status)

Supply an external table for persisting state (the selected group value).

Parameters

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

The container also defines OnWidthSet, OnHeightSet, and LayoutFinished for layout.

Callbacks

OnGroupSelected

callback#
lua
OnGroupSelected(value)

Fired when a group is selected, either by the user via the dropdown or programmatically through SetGroup. The handler should release and rebuild the content.

Parameters

ParameterTypeDefaultDescription
valuestringThe selected group's value.

Example

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

local group = AceGUI:Create("DropdownGroup")
group:SetTitle("Profile")
group:SetFullWidth(true)
group:SetLayout("Flow")

group:SetGroupList(
    { default = "Default", raid = "Raid", pvp = "PvP" },
    { "default", "raid", "pvp" }   -- explicit order
)

group:SetCallback("OnGroupSelected", function(container, event, key)
    container:ReleaseChildren()
    local lbl = AceGUI:Create("Label")
    lbl:SetText("Editing profile: " .. key)
    container:AddChild(lbl)
end)

-- select an initial group (this fires OnGroupSelected)
group:SetGroup("default")

Ace3, a World of Warcraft addon framework.