Thread Tools Display Modes
05-01-20, 01:47 AM   #1
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Nested subcategory options in addon interface options

I currently have an expandable category inside of my addon category for the interface options. When I expand the subcategory, the options show at the bottom instead of under the category being expanded. Is there any way to achieve the expected behavior of having them expand under this category? I can currently set this category to the last option in the addon's category list, but this will only be a bandaid as I planned on having more expandable subcategories in the future.

Here is a streamable video link demonstrating my issue.
https://streamable.com/kpvgrk
  Reply With Quote
05-01-20, 04:21 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Are you definitely setting the parent category as the category you want to expand it under ?

-- Set the name for the Category for the Panel
panel.name = "Profile Manager"

-- the panel.name value of the parent configuration panel, used to display a hierarchical category tree.
-- If the parent panel is not specified or does not exist, the panel is displayed as a top-level panel
panel.parent = "Parent Category Name"


Granted I don't have a triple layer of options yet in my UI addon so unless this is a limitation of Blizzards options panel system it should work in perpetuity (sp).
__________________
  Reply With Quote
05-01-20, 05:48 AM   #3
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
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."
  Reply With Quote
05-01-20, 10:03 AM   #4
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
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
05-01-20, 01:12 PM   #5
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
It is definitely an issue with Blizzard's code. I don't think they planned on subcategories of subcategories. If you add all secondary entries first then add the tertiary entries they will be in the correct order (but not indented correctly).
  Reply With Quote
05-01-20, 01:17 PM   #6
MinguasBeef
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 51
Originally Posted by Vrul View Post
It is definitely an issue with Blizzard's code. I don't think they planned on subcategories of subcategories. If you add all secondary entries first then add the tertiary entries they will be in the correct order (but not indented correctly).
Ooooh! That works! Thanks so much Vrul!
  Reply With Quote
05-01-20, 03:07 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Originally Posted by Vrul View Post
It is definitely an issue with Blizzard's code. I don't think they planned on subcategories of subcategories. If you add all secondary entries first then add the tertiary entries they will be in the correct order (but not indented correctly).
Ah, thanks for the heads up .. Will save me some time if I plan my UI options with that limitation in mind.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Nested subcategory options in addon interface options

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off