mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-31 07:56:57 +00:00
Scroll the config panels with ClassicAPI's scroll bar
pfUIScrollFrameTemplate (api/ui-widgets.xml) is a ScrollFrame with pfUIScrollBarTemplate inside its right edge and a Content scroll child, driven by ScrollUtil.InitScrollFrameWithScrollBar. The panels keep a ScrollFrame because the engine measures its range from the shown frames inside the content, which the hand-placed config rows rely on. The bar follows OnScrollRangeChanged instead of an OnUpdate poll per panel. A panel measures its range once its rows are built, and the search results measure theirs with UpdateScrollChildRect instead of hiding, re-attaching and scrolling a frame later. Clearing the search measures again too. CreateScrollFrame and CreateScrollChild have no users left, and nothing called CreateTabFrame or CreateTabChild; all four are gone. pfQuest's compat layer brings its own copies of the scroll helpers.
This commit is contained in:
+10
-13
@@ -515,14 +515,15 @@ pfUI:RegisterModule("gui", function ()
|
||||
|
||||
-- are we a frame with contents?
|
||||
if func then
|
||||
f.scroll = CreateScrollFrame(nil, f)
|
||||
f.scroll = CreateFrame("ScrollFrame", nil, f, "pfUIScrollFrameTemplate")
|
||||
SetAllPointsOffset(f.scroll, f, 2)
|
||||
f.scroll.content = CreateScrollChild(nil, f.scroll)
|
||||
f.scroll.content = f.scroll.Content
|
||||
f.scroll.content.parent = f.scroll
|
||||
f.scroll.content:SetScript("OnShow", function()
|
||||
if not this.setup then
|
||||
func()
|
||||
this.setup = true
|
||||
this.parent:UpdateScrollChildRect()
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -774,7 +775,10 @@ pfUI:RegisterModule("gui", function ()
|
||||
end
|
||||
end
|
||||
|
||||
if strlen(this:GetText()) < 1 then return end
|
||||
if strlen(this:GetText()) < 1 then
|
||||
parent:UpdateScrollChildRect()
|
||||
return
|
||||
end
|
||||
|
||||
local i = 1
|
||||
local search = strlower(this:GetText())
|
||||
@@ -798,16 +802,9 @@ pfUI:RegisterModule("gui", function ()
|
||||
end
|
||||
end
|
||||
|
||||
-- reload scroll frames
|
||||
scroll:Hide()
|
||||
scroll:SetHeight(i * 25 )
|
||||
scroll:Show()
|
||||
parent:SetScrollChild(scroll)
|
||||
QueueFunction(function()
|
||||
parent:SetVerticalScroll(0)
|
||||
parent:UpdateScrollState()
|
||||
parent:Scroll()
|
||||
end)
|
||||
-- measure the new results and start at the top
|
||||
parent:UpdateScrollChildRect()
|
||||
parent:SetVerticalScroll(0)
|
||||
end)
|
||||
|
||||
pfUI.gui.search:SetScript("OnEditFocusGained", function(self)
|
||||
|
||||
Reference in New Issue
Block a user