Using the Interface Options Addons panel

The Interface window includes a tab for third-party AddOns to share a common look and feel. This tutorial expands on instructions in the source code at FrameXML/InterfaceOptionsFrame.lua:483.
== Minimum requirements ==
It is minimally necessary to create a frame (panel), assign the .name field, and pass it to InterfaceOptions_AddCategory():
local panel = CreateFrame("Frame")
panel.name = "MyAddOn" -- see panel fields
InterfaceOptions_AddCategory(panel) -- see InterfaceOptions API
-- add widgets to the panel as desired
local title = panel:CreateFontString("ARTWORK", nil, "GameFontNormalLarge")
title:SetPoint("TOP")
title:SetText("MyAddOn")
== Panel fields ==
;Fields used when registering a new panel:
:;name : string - Name in the list of panels (customarily the AddOn name, unless it is a sub-panel).
:;parent : string? - The name of another panel to appear as a its sub-panel. If omitted, or if the other panel is not found, then this panel remains top-level.
;Fields used during user interaction:
:;refresh : function? - Callback when the panel first appears and also after default().
:;okay : function? - Callback when the user presses the Okay button to save settings.
:;cancel : function? - Callback when the user presses the Cancel button to discard changes.
:;default : function? - Callback when the user presses the Default button to restore default settings; followed by refresh().
== InterfaceOptions API ==
;InterfaceOptions_AddCategory(panel [, addOn, position]) : Adds a configuration panel.
:;panel : - A panel with widgets (children) to control an AddOn.
:;addOn : boolean? - Identifies an AddOn is from a third party; however, the argment has no effect because the function body checks ().
:;position : number? - Position in the list of panels; omitting defaults to alphabetical order.
;InterfaceAddOnsList_Update() : Prepares the InterfaceOptionsFrameAddOns buttons list, ensuring future calls to InterfaceOptionsFrame_OpenToCategory() will succeed.
;InterfaceOptionsFrame_OpenToCategory(panel) (DEPRECATED, use Settings.OpenToCategory(panel) instead) : Opens the Interface window to the chosen panel; however, this may fail the first time it is called unless preceeded by InterfaceAddOnsList_Update().
:;panel : |string - The registered panel, or its name.
;InterfaceOptionsFrame_Show() : Toggles visibility of the Interface Options frame.
== Details ==
* The panel's parent, anchors and visibility are controlled by the InterfaceOptions API.
* okay(), cancel(), default() and refresh() are called using () so errors in one AddOn do not prevent another from applying changes. During debugging, it is necessary to wrap code in to identify errors.
function panel.okay()
	xpcall(function()
		-- your original panel.okay() code goes here
	end, geterrorhandler())
end
== Examples ==
Fitting many options inside the border texture using a :
local panel = CreateFrame("Frame")
panel.name = "MyAddOn"
InterfaceOptions_AddCategory(panel)
-- Create the scrolling parent frame and size it to fit inside the texture
local scrollFrame = CreateFrame("ScrollFrame", nil, panel, "UIPanelScrollFrameTemplate")
scrollFrame:SetPoint("TOPLEFT", 3, -4)
scrollFrame:SetPoint("BOTTOMRIGHT", -27, 4)
-- Create the scrolling child frame, set its width to fit, and give it an arbitrary minimum height (such as 1)
local scrollChild = CreateFrame("Frame")
scrollFrame:SetScrollChild(scrollChild)
scrollChild:SetWidth(InterfaceOptionsFramePanelContainer:GetWidth()-18)
scrollChild:SetHeight(1) 
-- Add widgets to the scrolling child frame as desired
local title = scrollChild:CreateFontString("ARTWORK", nil, "GameFontNormalLarge")
title:SetPoint("TOP")
title:SetText("MyAddOn")
local footer = scrollChild:CreateFontString("ARTWORK", nil, "GameFontNormal")
footer:SetPoint("TOP", 0, -5000)
footer:SetText("This is 5000 below the top, so the scrollChild automatically expanded.")
HelloWorld example from Create a WoW AddOn in 15 Minutes:
== Patch changes ==
* 
* 
== References ==