Since patch 2.4.0, World of WarCraft allowed addons to place their options into their normal Interface Options panel. It is a neat option for having a centralize point for the addon options. Mizus RaidTracker places a few panels there.
While adding new options, I ran out of place in two of my options panels for MRT. One obvious solution is to split them up in two then, when it is possible. For one panel, I had the opportunity to break up one panel into two new subject areas with an equal count of options.
For the other panel, it wasn’t possible. Sure, I could have split them up on two panels and name them like “Export Options 1” and “Export Options 2”, but I think it is rather inconvenient for a user to search on two panels for an option for a specific subject. A ScrollFrame was needed.
Surprisingly, it wasn’t that easy to implement one in the options panel. My first approach was rather straight forward – I defined a new ScrollFrame and defined the old panel as its ScrollChild. The result looked something like that:
The scroll bar was way out of the interface panel. I played around with the size of the ScrollFrame and with its Anchor relative to the Interface Options frame or the panel area itself, but nothing changed the positioning of the frame. It seems, that the function ‘InterfaceOptions_AddCategory(panel)’, which registers a panel to that Interface Options frame, overwrites any size and anchor information. Even setting new anchors after an OnShow-Event hadn’t any effect.
So i searched for a new approach: I knew that I can’t affect the frame, which I register as a panel – but its child frames. So I defined another frame and put my ScrollFrame into that new frame as a child frame. After that, I anchored the ScrollFrame relative to its new parent frame. And finally, I could reposition my scroll bar. The end result looks like this:
And this is the XML code I used for that:
<Frame name="MRT_Options_ExportPanel_ScrollFrame_Parent"> <Frames> <ScrollFrame name="MRT_Options_ExportPanel_ScrollFrame" inherits="UIPanelScrollFrameTemplate"> <Anchors> <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="$parent" x="0" y="-5"/> <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent" x="0" y="5"/> <Anchor point="RIGHT" relativePoint="RIGHT" relativeTo="$parent" x="-28"/> </Anchors> <ScrollChild> <Frame name="MRT_Options_ExportPanel"> <Size x="350" y="450"/> <!-- Option panel items are defined here --> </Frame> </ScrollChild> </ScrollFrame> </Frames> </Frame>
This is a solution I came up with myself. It works and produces the result I wanted, but I think, it is more of a workaround than a good solution. I haven’t found any solution for this problem on the internet, so if you know a cleaner solution, feel free to leave a comment.