An alternative to using the AceGUI container BlizOptionsGroup to create entries in the Blizzard options panel. All entries created use the same frame objects allowing for minimal memory use. An entry can be created and an options table assigned to it later allowing for LOD options. The library monitors for AceConfigDialog-3.0, AceConfigRegistry-3.0, and AceGUI-3.0 to be loaded before using them to further facilitate LOD behavior.
-- In main module (myAddon):
myAddon.config = LibStub('LibOptionsAssist-1.0'):AddEntry("myAddon", nil, "myAddon_Config")
myAddon.config:SetInfo(format("Version: %s", GetAddOnMetadata("myAddon", 'Version')))
-- In LOD module (myAddon_Config):
Add an entry to Blizzard's interface options panel under the AddOns tab.
name - (string) The text to appear in the Blizzard options panel under the AddOns tab.
parent - (string) If this is to be a child entry then this should be the name that was used to create the parent entry.
loadOnDemand - (function or string) If a function is given then that function will be run the first time the entry is selected, passing entry as it's only argument. If a string is given, or if the function returns a string, an addon with that name will be loaded if it isn't already.
entry - (table) A table with the required fields to work with the Blizzard options panel (see Entries below).
index = lib:HasEntry(name [, parent])
Determines if an entry is in Blizzard's interface options panel under the AddOns tab.
name - (string) The name of the entry to check for.
parent - (string) The name of the parent entry if a child is being looked for.
index - (number) Index of the entry or nil if it doesn't exist.
index, entry = lib:IterateEntries([parent])
Acts as a special case ipairs for Blizzard's INTERFACEOPTIONS_ADDONCATEGORIES table.
parent - (string) If a string is provided then all entries returned will be children of that parent, otherwise only entries with no parent are returned.
index - (number) Index of the entry.
entry - (table) The table for the entry.
loaded, reason = lib:LoadModule(name)
Loads an addon even if it is disabled.
name - (string) The addon's name as it appears in the Interface\AddOns folder.
loaded - (boolean) Whether or not the addon is loaded.
reason - (string) If the addon is not loaded then this will be the reason why.
Any entry created by lib:AddEntry() is a normal table that emulates certain frame methods to allow it to work in the Blizzard options panel. A metatable provides the following frame-like methods: ClearAllPoints, GetScript, HasScript, Hide, IsShown, IsVisible, SetAllPoints, SetParent, SetPoint, SetScript, and Show. The only scripts supported by an entry are OnHide and OnShow. The metatable also provides a dummy function for the fields: cancel, defaults, okay, and refresh.
The entry may also be treated like a function, with entry() being the same as InterfaceOptionsFrame_OpenToCategory(entry). Entries also have the following additional methods:
entry:AssignOptions(name [, ...])
Set the AceConfigRegistry-3.0 table to be used to display options when the entry is selected.
name - (string) A name as from an AceConfigRegistry-3.0 RegisterOptionsTable call.
... - Zero or more table keys that lead to a sub-table.
Cancel any pending LOD behavior for the entry.
desc = entry:GetDesc()
Get the value currently set to be displayed for the entry's description text.
desc - (string) The current value of the description text.
info = entry:GetInfo()
Get the value currently set to be displayed for the entry's information text.
info - (string) The current value of the information text.
title = entry:GetTitle()
Get the value currently set to be displayed for the entry's title text.
title - (string) The current value of the title text.
Force a display update of the assigned options.
Set the description text to be displayed. This text is small, left-aligned, and below the title.
desc - (string) The text to be displayed.
Set the information text to be displayed. This text is small, right-aligned, and opposite the title.
info - (string) The text to be displayed.
Set the title text to be displayed. This text is large, left-aligned, and anchored in the upper-left corner. When an entry is first created with lib:AddEntry() the title is automatically set to the name given.
title - (string) The text to be displayed.
Version 1.0.4 (12/25/2013)
- Put in a temp fix for the Blizzard bug that prevents opening directly to an option panel the first time
Version 1.0.3 (06/13/2013)
- Fixed a logic flow issue with LoD
Version 1.0.2 (05/18/2010)
- Fixed a couple display issues
- Info text no longer requires the title text to be shown
- Added description text
- Extended the LOD support
Version 1.0.1 (07/05/2009)
- Added MMOUI Minion support to TOC file (X-WoWI-ID)
- Fixed a display bug when hiding an entry