View Single Post
10-09-21, 08:25 AM   #8
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
I modified it a little bit. Since Skillet has 3 sub-categories and as written, it always puts the main category at the bottom. I added an offset value so that once expanded, Skillet and its sub-categories were always on the screen.

Lua Code:
  1. local function ScrollToCategory(panelName,offset)
  2.     local idx = 0
  3.     InterfaceOptionsFrameAddOnsListScrollBar:SetValue(0)
  4.     for i,cat in ipairs(INTERFACEOPTIONS_ADDONCATEGORIES) do
  5.         if not cat.hidden then
  6.             idx = idx + 1
  7.             if cat.name == panelName then
  8.                 break
  9.             end
  10.         end
  11.     end
  12.     local numbuttons = #(InterfaceOptionsFrameAddOns.buttons)
  13.     if idx and numbuttons and idx > numbuttons then
  14.         local btnHeight = InterfaceOptionsFrameAddOns.buttons[1]:GetHeight()
  15.         InterfaceOptionsFrameAddOnsListScrollBar:SetValue((offset+idx-numbuttons)*btnHeight)
  16.     end
  17. end

I guess the code should worry about setting a value that exceeds the maximum.
  Reply With Quote