WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Using the Interface Options Addons panel (https://www.wowinterface.com/forums/showthread.php?t=59569)

AeroMaxxD 04-30-23 06:27 AM

Using the Interface Options Addons panel
 
I'm wanting to use the Interface Options Addons Panel on my new addon.

I create a test addon with the code below which is an example from https://wowpedia.fandom.com/wiki/Usi...s_Addons_panel but this only partially works.

For example I get a scroll bar in the interface options, but I don't get any text within the options pane this creates, and thus also not able to use the scroll bar as there is nothing to scroll.

Lua Code:
  1. local panel = CreateFrame("Frame")
  2. panel.name = "MyAddOn"
  3. InterfaceOptions_AddCategory(panel)
  4.  
  5. -- Create the scrolling parent frame and size it to fit inside the texture
  6. local scrollFrame = CreateFrame("ScrollFrame", nil, panel, "UIPanelScrollFrameTemplate")
  7. scrollFrame:SetPoint("TOPLEFT", 3, -4)
  8. scrollFrame:SetPoint("BOTTOMRIGHT", -27, 4)
  9.  
  10. -- Create the scrolling child frame, set its width to fit, and give it an arbitrary minimum height (such as 1)
  11. local scrollChild = CreateFrame("Frame")
  12. scrollFrame:SetScrollChild(scrollChild)
  13. scrollChild:SetWidth(InterfaceOptionsFramePanelContainer:GetWidth()-18)
  14. scrollChild:SetHeight(1)
  15.  
  16. -- Add widgets to the scrolling child frame as desired
  17. local title = scrollChild:CreateFontString("ARTWORK", nil, "GameFontNormalLarge")
  18. title:SetPoint("TOP")
  19. title:SetText("MyAddOn")
  20.  
  21. local footer = scrollChild:CreateFontString("ARTWORK", nil, "GameFontNormal")
  22. footer:SetPoint("TOP", 0, -5000)
  23. footer:SetText("This is 5000 below the top, so the scrollChild automatically expanded.")

briskman3000 04-30-23 09:42 PM

In your SetPoint calls, you need to add the parent panel variable to anchor it to.

Since you are using the variable "panel"

for example:
Lua Code:
  1. title:SetPoint("TOP")

should really be

Lua Code:
  1. title:SetPoint("TOP", panel)

Also move the

Lua Code:
  1. InterfaceOptions_AddCategory(panel)

to the bottom of all of your panel code

AeroMaxxD 04-30-23 11:49 PM

I tried your changes but still doesn't work.

Lua Code:
  1. local panel = CreateFrame("Frame");
  2. panel.name = "MyAddOn";
  3.  
  4. -- Create the scrolling parent frame and size it to fit inside the texture
  5. local scrollFrame = CreateFrame("ScrollFrame", nil, panel, "UIPanelScrollFrameTemplate");
  6. scrollFrame:SetPoint("TOPLEFT", panel, "TOPLEFT", 3, -4);
  7. scrollFrame:SetPoint("BOTTOMRIGHT", panel, "BOTTOMRIGHT", -27, 4);
  8.  
  9. -- Create the scrolling child frame, set its width to fit, and give it an arbitrary minimum height (such as 1)
  10. local scrollChild = CreateFrame("Frame", nil, panel);
  11. scrollFrame:SetScrollChild(scrollChild);
  12. scrollChild:SetWidth(InterfaceOptionsFramePanelContainer:GetWidth()-18);
  13. scrollChild:SetHeight(1);
  14.  
  15. -- Add widgets to the scrolling child frame as desired
  16. local title = scrollChild:CreateFontString("ARTWORK", nil, "GameFontNormalLarge");
  17. title:SetPoint("TOP", scrollChild, "TOP");
  18. title:SetText("MyAddOn");
  19.  
  20. local footer = scrollChild:CreateFontString("ARTWORK", nil, "GameFontNormal");
  21. footer:SetPoint("TOP", scrollChild, "TOP", 0, -5000);
  22. footer:SetText("This is 5000 below the top, so the scrollChild automatically expanded.");
  23.  
  24. InterfaceOptions_AddCategory(panel);

briskman3000 05-01-23 07:46 AM

Probably because you used "scrollChild" instead of "panel" in the SetPoint Calls.

Also you have a second instance of "TOP" in your footer SetPoint. That probably breaks something too.

AeroMaxxD 05-02-23 02:12 PM

Quote:

Originally Posted by briskman3000 (Post 342408)
Probably because you used "scrollChild" instead of "panel" in the SetPoint Calls.

Ok I will try that.

Quote:

Originally Posted by briskman3000 (Post 342408)
Also you have a second instance of "TOP" in your footer SetPoint. That probably breaks something too.

The link say it's fine. It does that anyway when you omit it.

https://wowpedia.fandom.com/wiki/API...izing_SetPoint


All times are GMT -6. The time now is 06:10 PM.

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