WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Nested subcategory options in addon interface options (https://www.wowinterface.com/forums/showthread.php?t=57973)

MinguasBeef 05-01-20 01:47 AM

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

Xrystal 05-01-20 04:21 AM

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).

Vrul 05-01-20 05:48 AM

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."

MinguasBeef 05-01-20 10:03 AM

Quote:

Originally Posted by Vrul (Post 335800)
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)


Vrul 05-01-20 01:12 PM

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).

MinguasBeef 05-01-20 01:17 PM

Quote:

Originally Posted by Vrul (Post 335803)
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! :)

Xrystal 05-01-20 03:07 PM

Quote:

Originally Posted by Vrul (Post 335803)
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.


All times are GMT -6. The time now is 12:03 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI