Using the Interface Options Addons panel

Revision as of 19:20, August 9, 2010 by Tcaresset (Talk | contribs)

103,443pages on
this wiki

These are the commands that are needed to use Blizzard's Interface Options Addons framework.

As we use a Frame, we can do anything we like within it. Just like doing any other GUI Frame. You can also do sub-categories within these panels as well.

Most of this has been taken from One Blue post on the World of Warcraft Forums (

Description of the panel parts - a required string
is the name of the Category to be listed in the Interface Options - Addon list.
panel.okay - Optional function()
This is a function that is called when the player presses the Okay button.
panel.cancel - Optional function()
This is a function that is called when the player presses the Cancel Button.
panel.default - Optional function()
This is a function that is called when the player presses the Default Button.
panel.parent - an optional string
Name of the parent of the AddOn or group of configuration options. This identifies "panel" as the child of another category. If the parent category doesn't exist, "panel" will be displayed as a regular category.
panel.refresh - Optional function()
This method will run when the Interface Options frame calls its OnShow function and after defaults have been applied via the panel.default method described above. Use this to refresh your panel's UI in case settings have been changed without player interaction. (-- from a post by Zootfizzle)

Example XML with Okay and Cancel buttons

This example is taken from an addon called SC_ChaChing, available from

The XML frame

All we need to do first is to create the Frame. As we are using the Interface Options - Addon panels, we do not need to use any sizing or movement options.

The OnLoad script calls the Panel_OnLoad() function.

XML Frame
    <Frame name="SC_ChaChingGUIFrame">
        . . .

The Lua function

All we need to do with this function, is to set the name of the panel. Along with the Functions needed for the Okay and Cancel Buttons. Then to call the function that adds the Category to the Interface Options - Addon Category list.

Lua Function
    function SC_ChaChingPanel_OnLoad(panel)
        . . .

        -- Set the name for the Category for the Panel
        -- = "SC_ChaChing " .. GetAddOnMetadata("SC_ChaChing", "Version");

        -- When the player clicks okay, run this function.
        panel.okay = function (self) SC_ChaChingPanel_Close(); end;

        -- When the player clicks cancel, run this function.
        panel.cancel = function (self)  SC_ChaChingPanel_CancelOrLoad();  end;

        -- Add the panel to the Interface Options

Example entirely in Lua

 MyAddon = {};
 MyAddon.panel = CreateFrame( "Frame", "MyAddonPanel", UIParent );
 -- Register in the Interface Addon Options GUI
 -- Set the name for the Category for the Options Panel = "MyAddon";
 -- Add the panel to the Interface Options
 -- Make a child panel
 MyAddon.childpanel = CreateFrame( "Frame", "MyAddonChild", MyAddon.panel); = "MyChild";
 -- Specify childness of this panel (this puts it under the little red [+], instead of giving it a normal AddOn category)
 MyAddon.childpanel.parent =;
 -- Add the child to the Interface Options

Directly opening your options panel

If you wish to open your addon's options panel directly – for example, with a slash command – you can do so by calling a single function:




Around Wikia's network

Random Wiki