Appearance
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 isDropdownGroup(lowercase "down"). Use that exact string withAceGUI: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
| Parameter | Type | Default | Description |
|---|---|---|---|
list | table | Table mapping each group's value to its display text ([value] = text). | |
order (optional) | table | Array 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
| Parameter | Type | Default | Description |
|---|---|---|---|
group | string | The 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
| Parameter | Type | Default | Description |
|---|---|---|---|
title | string | Title string, or "" for none. |
SetDropdownWidth
method#
lua
container:SetDropdownWidth(width)Set the width of the dropdown selector (defaults to 200 pixels on acquire).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
width | number | Width in pixels. |
SetStatusTable
method#
lua
container:SetStatusTable(status)Supply an external table for persisting state (the selected group value).
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
status | table | A table you own and keep alive (asserted to be of type table). |
The container also defines
OnWidthSet,OnHeightSet, andLayoutFinishedfor 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
| Parameter | Type | Default | Description |
|---|---|---|---|
value | string | The 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")