I have used FauxScrollFrame for my Updates Splash Frame in my new UI addon and it works fine .. The base frame is shown, with the scrollframe inside it, with the fontstrings containing text or emptiness as required.
I then copied the functionality over for my profile list in the options screen and changed the appropriate variables and after opening the options screen, selecting the addon, then the profile page ( in this case ) it then shows the caption and scroll frame but no fontrstring contents.
Framestack shows the individual fontstrings in both frames so they are being created and I have hard coded them to show regardless of content, so , should show whatever the text is.
If anyone can see something that I have not noticed for some reason (despite going through it several times and it being a copy and past with appropriate changes made) it would be appreciated.
Splash Screen ( FauxScrollFrame segment ) XML and Load/Update lua code blocks
Lua Code:
<Frame parentKey = "LatestUpdates">
<Anchors>
<Anchor point = "TOP" relativeKey = "$parent.LatestUpdateCaption" relativePoint = "BOTTOM" x = "0" y = "-5"/>
<Anchor point = "BOTTOM" relativeKey = "$parent.Copyright" relativePoint = "TOP" x = "0" y = "5" />
<Anchor point = "LEFT" x = "5" y = "0" />
<Anchor point = "RIGHT" x = "-30" y = "0" />
</Anchors>
<Backdrop edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<EdgeSize val="8"/>
<TileSize val="8"/>
<BackgroundInsets left="0" right="0" top="0" bottom="0"/>
</Backdrop>
<Frames>
<ScrollFrame name = "$parentScrollFrame" parentKey = "ScrollFrame" inherits = "FauxScrollFrameTemplate">
<Anchors>
<Anchor point = "TOPLEFT" x = "0" y = "-5" />
<Anchor point = "BOTTOMRIGHT" x = "-25" y = "5" />
</Anchors>
<Scripts>
<OnShow>
XrystalUI_SplashScroll_Update(self)
</OnShow>
<OnVerticalScroll>
FauxScrollFrame_OnVerticalScroll(self,offset,12, XrystalUI_SplashScroll_Update)
</OnVerticalScroll>
</Scripts>
</ScrollFrame>
</Frames>
<Scripts>
<OnLoad>
XrystalUI_SplashUpdates_OnLoad(self)
</OnLoad>
</Scripts>
</Frame>
Lua Code:
------------------------------------------------------------------------------
-- Fill the font strings with information to display in the scroll frame
------------------------------------------------------------------------------
function XrystalUI_SplashScroll_Update(self)
local offset = FauxScrollFrame_GetOffset(self)
FauxScrollFrame_Update(self,50,1,12)
self.List = self.List or {}
if #self.List == 0 then return end
if not addonData.versionHistory then return end
local versionHistory = addonData.versionHistory
if not versionHistory then return end
for i = 1,16 do
local idx = offset + i
if idx < 50 + 1 and versionHistory[idx] then
self.List[i]:SetText(versionHistory[idx].Version .. " : " .. versionHistory[idx].Content)
self.List[i]:Show()
else
self.List[i]:SetText("")
self.List[i]:Hide()
end
end
end
------------------------------------------------------------------------------
-- Create Font Strings
------------------------------------------------------------------------------
function XrystalUI_SplashUpdates_OnLoad(self)
self.ScrollFrame.List = {}
self.ScrollBar = self.ScrollFrame.ScrollBar
for i = 1,50 do
self.ScrollFrame.List[i] = self:CreateFontString(nil,"OVERLAY","XrystalUI_ScrollingText")
self.ScrollFrame.List[i]:SetWidth(self.ScrollFrame:GetWidth() - 25)
self.ScrollFrame.List[i]:SetHeight(12)
if i == 1 then
self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame,"TOPLEFT",5,-5)
else
self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame.List[i - 1],"BOTTOMLEFT",0,0)
end
self.ScrollFrame.List[i]:SetJustifyV("TOP")
self.ScrollFrame.List[i]:SetJustifyH("LEFT")
end
self.ScrollBar:SetValue(0) -- go to top
XrystalUI_SplashScroll_Update(self.ScrollFrame) -- update list
end
All this does is extract the relevant changes to the addon since the last update and displays it on the screen. Very basic at the moment and I tell it to display it every time rather than only if the version is different. So I know it works as expected still ...
Now, the options screen's profile management page, is supposed to have the same type of scroll list except instead of contact version update text it is supposed to contact a list of profiles that exist ( there is always at least one - the built in one ). Here is the equivalent code for this part of the addon.
Lua Code:
<Frame parentKey = "Registered Profiles">
<Anchors>
<Anchor point = "TOP" relativeKey = "$parent.Title" relativePoint = "BOTTOM" x = "0" y = "-5"/>
<Anchor point = "BOTTOM" x = "0" y = "5" />
<Anchor point = "LEFT" x = "5" y = "0" />
<Anchor point = "RIGHT" x = "-30" y = "0" />
</Anchors>
<Backdrop edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<EdgeSize val="8"/>
<TileSize val="8"/>
<BackgroundInsets left="0" right="0" top="0" bottom="0"/>
</Backdrop>
<Frames>
<ScrollFrame name = "$parentScrollFrame" parentKey = "ScrollFrame" inherits = "FauxScrollFrameTemplate">
<Anchors>
<Anchor point = "TOPLEFT" x = "0" y = "-5" />
<Anchor point = "BOTTOMRIGHT" x = "-25" y = "5" />
</Anchors>
<Scripts>
<OnShow>
XrystalUI_ProfileList_Update(self)
</OnShow>
<OnVerticalScroll>
FauxScrollFrame_OnVerticalScroll(self,offset,12, XrystalUI_ProfileList_Update)
</OnVerticalScroll>
</Scripts>
</ScrollFrame>
</Frames>
<Scripts>
<OnLoad>
XrystalUI_ProfileList_OnLoad(self)
</OnLoad>
</Scripts>
</Frame>
Lua Code:
------------------------------------------------------------------------------
-- Scroll Frame Update Routine
------------------------------------------------------------------------------
function XrystalUI_ProfileList_Update(self)
local offset = FauxScrollFrame_GetOffset(self)
FauxScrollFrame_Update(self,50,1,12)
self.List = self.List or {}
if #self.List == 0 then return end
if not addonData.profileManager then return end
local profiles = addonData.profileManager:ListProfiles()
if not profiles then return end
for i = 1,16 do
local idx = offset + i
if idx < 50 + 1 and profiles[idx] then
self.List[i]:SetText("Content " .. idx)--(profiles[idx])
self.List[i]:Show()
else
self.List[i]:SetText("Empty " .. idx)--("")
self.List[i]:Show()
end
self.List[i]:SetText("Something " .. idx)
self.List[i]:Show()
end
end
------------------------------------------------------------------------------
-- Scroll Frame OnLoad Routine
------------------------------------------------------------------------------
function XrystalUI_ProfileList_OnLoad(self)
self.ScrollFrame.List = {}
self.ScrollBar = self.ScrollFrame.ScrollBar
for i = 1,50 do
self.ScrollFrame.List[i] = self:CreateFontString(nil,"OVERLAY","XrystalUI_ScrollingText")
self.ScrollFrame.List[i]:SetWidth(self.ScrollFrame:GetWidth() - 25)
self.ScrollFrame.List[i]:SetHeight(12)
if i == 1 then
self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame,"TOPLEFT",5,-5)
else
self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame.List[i - 1],"BOTTOMLEFT",0,0)
end
self.ScrollFrame.List[i]:SetJustifyV("TOP")
self.ScrollFrame.List[i]:SetJustifyH("LEFT")
end
self.ScrollBar:SetValue(0) -- go to top
XrystalUI_ProfileList_Update(self.ScrollFrame) -- update list
end
As you can see I even tried hard coding text to display and nothing is showing up at all even though I am using the same fontstring template code which is as follows:
Lua Code:
<UI xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Include file = "Templates/Fonts.xml" />
<FontString name = "XrystalUI_ScrollingText" parentArray = "List" inherits = "XrystalUI_Font_08" text = "" virtual = "true">
<Anchors>
<Anchor point = "TOPLEFT" x = "0" y = "2" />
</Anchors>
<Color r = "1.00" g = "1.00" b = "1.00" />
</FontString>
</UI>
The templates are loaded first so that anything that needs them can access them so that isn't the problem.
Thanks for reading all the way day. Any thoughts are appreciated. I know it might not be the best way but it worked the first time round so was expecting it to work the second time round.