WoW:Using the Interface Options Addons panel: Difference between revisions

m
→‎Removing an existing options panel: Added this secion. Feel free to reword it or make it nicer ;-)
(→‎The XML frame: spelling)
m (→‎Removing an existing options panel: Added this secion. Feel free to reword it or make it nicer ;-))
Line 93: Line 93:


   InterfaceOptionsFrame_OpenToCategory(panel.name);
   InterfaceOptionsFrame_OpenToCategory(panel.name);
== Removing an existing options panel ==
If you wish to remove any of the options panels for whatever reason after they have been created (maybe to modify another addon's options) there is no blizzard function avalible to do this but it can be done with the folowing function:
  function RemoveInterfaceOptions(Parent, Child)
  local bChildPanel = true;
  if (Child == nil) then -- Assume we are removing the whole panel if no child was specified
  Child = Parent;
  bChildPanel = false;
  AceConfigDialog3.BlizOptions[Parent] = nil;
  else
  AceConfigDialog3.BlizOptions[Parent][Parent.."\001".. Child] = nil;
  end;
 
  for Key,Value in pairs(INTERFACEOPTIONS_ADDONCATEGORIES) do
  if (bChildPanel and ((Value.parent == Parent) and (Value.name == Child))) then -- We are looking for a child panel and this is it...
  INTERFACEOPTIONS_ADDONCATEGORIES[Key] = nil;
  end;
 
  if (not(bChildPanel) and ((Value.parent == nil) and (Value.name == Child))) then -- We are looking for a parent and this is it...
  INTERFACEOPTIONS_ADDONCATEGORIES[Key] = nil;
  elseif (not(bChildPanel) and ((Value.parent == Parent))) then -- We are looking for a parent and this is it's child...
  INTERFACEOPTIONS_ADDONCATEGORIES[Key] = nil;
  end;
  end;
 
  InterfaceAddOnsList_Update();
  end;
This function takes two peramiters "Parent" and "Child" and they are both strings:
* Parent is the name of the main panel (normally the name of the addon)
* Child is the name of any child panels you wish to remove
If both Parent and Child are given then the function removes only the child panel from the parent. If however only the parent is given then the whole panel and all child panels are removed.
[[Category:HOWTOs|Using the Interface Options Addons panel]]
[[Category:HOWTOs|Using the Interface Options Addons panel]]
Anonymous user