Skip to content

BlizOptionsGroup

A container that embeds AceGUI options into the Blizzard Interface Options panel.

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

Widget type: BlizOptionsGroup

This container's frame is parented to the Blizzard Interface Options panel container and exposes the handlers Blizzard expects, which fire the okay/cancel/default/refresh callbacks below. It is typically registered with InterfaceOptions_AddCategory or Settings.RegisterCanvasLayoutCategory via its frame.

On the 10.0+ Settings API the panel's OnCommit/OnDefault/OnRefresh frame handlers are wired to the same okay/ default/refresh functions, so the callbacks you register fire on both old and new clients. You register the callbacks below, never OnCommit/OnDefault/OnRefresh directly.

Methods

SetName

method#
lua
container:SetName(name, parent?)

Set the panel's name and (optional) parent category as used by the Blizzard options registration. These map onto frame.name and frame.parent.

Parameters

ParameterTypeDefaultDescription
namestringThe category name shown in the options list.
parent (optional)stringParent category name (for nesting as a sub-panel).

SetTitle

method#
lua
container:SetTitle(title)

Set the large heading shown at the top of the panel. A non-empty title shifts the content area down to make room; an empty or nil title removes the heading and tightens the layout.

Parameters

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

The container also defines OnWidthSet and OnHeightSet for layout.

Callbacks

OnShow

callback#
lua
OnShow()

Fired when the panel's frame is shown (the user opens this options category).

OnHide

callback#
lua
OnHide()

Fired when the panel's frame is hidden.

okay

callback#
lua
okay()

Fired when Blizzard calls the panel's okay handler (settings accepted or Okay button clicked).

cancel

callback#
lua
cancel()

Fired when Blizzard calls the panel's cancel handler (changes discarded). Note: the cancel handler was removed in the version 10.0 settings system, so it may not fire on modern clients.

default

callback#
lua
default()

Fired when Blizzard calls the panel's default handler (restore defaults).

refresh

callback#
lua
refresh()

Fired when Blizzard calls the panel's refresh handler (the panel needs to re-read current values).

Example

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

local panel = AceGUI:Create("BlizOptionsGroup")
panel:SetName("My Addon")
panel:SetTitle("My Addon Options")
panel:SetLayout("Flow")

local cb = AceGUI:Create("CheckBox")
cb:SetLabel("Enable feature")
panel:AddChild(cb)

panel:SetCallback("refresh", function(container, event)
    cb:SetValue(MyAddonDB.enabled)
end)
panel:SetCallback("okay", function(container, event)
    -- settings accepted; persist if needed
end)

-- register the panel's frame with the Blizzard options UI
local category = Settings.RegisterCanvasLayoutCategory(panel.frame, "My Addon")
Settings.RegisterAddOnCategory(category)

Ace3, a World of Warcraft addon framework.