Quantcast
WoWInterface - View Single Post - Nested subcategory options in addon interface options
View Single Post
05-01-20, 10:03 AM   #4
MinguasBeef
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 33
Originally Posted by Vrul View Post
The number one rule in asking for help is to post your code. It is hard to help with out seeing the code in question.

The current code for Minguas Suite has this:
Code:
function PanelManager:CreateSubcategoryPanel(panelName)
    local panel = CreateFrame("Frame")
    panel.parent = self.primaryPanel.name
    panel.name = panelName

    panel.AddCheckbox = function(...) PanelManager.AddCheckbox(...) end
    panel.AddSlider = function(...) PanelManager.AddSlider(...) end
    panel.children = {}

    InterfaceOptions_AddCategory(panel)
    return panel
end
That is functionally equivalent to:
Code:
function PanelManager:CreateSubcategoryPanel(panelName)
    local panel = CreateFrame("Frame")
    panel.parent = self.primaryPanel.name
    panel.name = panelName

    panel.AddCheckbox = PanelManager.AddCheckbox
    panel.AddSlider = PanelManager.AddSlider
    panel.children = {}

    InterfaceOptions_AddCategory(panel)
    return panel
end
If you are using that function to add your subcategories for "Enemy Cooldown Tracker" then you are blindly setting the parent to "Minguas Suite" for every subcategory. But I'm not sure how that could be the case unless you are manually setting panel.hasChildren for "Enemy Cooldown Tracker."
Sorry, I didn't post the code just because it would've been a lot of code for someone to look at for the example in the video. The code has been changed a bit since the version that was uploaded to the website. I'm assuming this is just some kind of limitation in wow's interface options.

Here is a reproducible example.

Code:
panelLevel1 = CreateFrame("Frame")
panelLevel1.name = "Panel Level 1"
InterfaceOptions_AddCategory(panelLevel1)

panelLevel2A = CreateFrame("Frame")
panelLevel2A.parent = panelLevel1.name
panelLevel2A.name = "Panel Level 2A"
InterfaceOptions_AddCategory(panelLevel2A)

panelLevel3A = CreateFrame("Frame")
panelLevel3A.parent = panelLevel2A.name
panelLevel3A.name = "Panel Level 3A"
InterfaceOptions_AddCategory(panelLevel3A)

panelLevel2B = CreateFrame("Frame")
panelLevel2B.parent = panelLevel1.name
panelLevel2B.name = "Panel Level 2B"
InterfaceOptions_AddCategory(panelLevel2B)

panelLevel3B = CreateFrame("Frame")
panelLevel3B.parent = panelLevel2B.name
panelLevel3B.name = "Panel Level 3B"
InterfaceOptions_AddCategory(panelLevel3B)

Last edited by MinguasBeef : 05-01-20 at 10:06 AM.
  Reply With Quote