Thread Tools Display Modes
Prev Previous Post   Next Post Next
05-25-20, 09:14 AM   #1
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
FauxScrollFrame Issues

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:
  1. <Frame parentKey = "LatestUpdates">
  2.                 <Anchors>
  3.                     <Anchor point = "TOP" relativeKey = "$parent.LatestUpdateCaption" relativePoint = "BOTTOM" x = "0" y = "-5"/>
  4.                     <Anchor point = "BOTTOM" relativeKey = "$parent.Copyright" relativePoint = "TOP" x = "0" y = "5" />
  5.                     <Anchor point = "LEFT" x = "5" y = "0" />
  6.                     <Anchor point = "RIGHT" x = "-30" y = "0" />
  7.                 </Anchors>
  8.                 <Backdrop edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
  9.                     <EdgeSize val="8"/>
  10.                     <TileSize val="8"/>
  11.                     <BackgroundInsets left="0" right="0" top="0" bottom="0"/>
  12.                 </Backdrop>                
  13.                 <Frames>
  14.                    
  15.                     <ScrollFrame name = "$parentScrollFrame" parentKey = "ScrollFrame" inherits = "FauxScrollFrameTemplate">
  16.                         <Anchors>
  17.                             <Anchor point = "TOPLEFT" x = "0" y = "-5" />
  18.                             <Anchor point = "BOTTOMRIGHT" x = "-25" y = "5" />
  19.                         </Anchors>
  20.                         <Scripts>
  21.                             <OnShow>
  22.                                 XrystalUI_SplashScroll_Update(self)
  23.                             </OnShow>
  24.                             <OnVerticalScroll>
  25.                                 FauxScrollFrame_OnVerticalScroll(self,offset,12, XrystalUI_SplashScroll_Update)
  26.                             </OnVerticalScroll>
  27.                         </Scripts>
  28.                     </ScrollFrame>
  29.                    
  30.                 </Frames>
  31.                 <Scripts>
  32.                     <OnLoad>
  33.                         XrystalUI_SplashUpdates_OnLoad(self)
  34.                     </OnLoad>
  35.                 </Scripts>
  36.             </Frame>

Lua Code:
  1. ------------------------------------------------------------------------------
  2. -- Fill the font strings with information to display in the scroll frame
  3. ------------------------------------------------------------------------------
  4. function XrystalUI_SplashScroll_Update(self)
  5.     local offset = FauxScrollFrame_GetOffset(self)
  6.     FauxScrollFrame_Update(self,50,1,12)
  7.     self.List = self.List or {}
  8.     if #self.List == 0 then return end
  9.     if not addonData.versionHistory then return end
  10.     local versionHistory = addonData.versionHistory
  11.     if not versionHistory then return end
  12.     for i = 1,16 do
  13.         local idx = offset + i
  14.         if idx < 50 + 1 and versionHistory[idx] then
  15.             self.List[i]:SetText(versionHistory[idx].Version .. " : " .. versionHistory[idx].Content)
  16.             self.List[i]:Show()
  17.         else
  18.             self.List[i]:SetText("")
  19.             self.List[i]:Hide()
  20.         end
  21.     end
  22. end
  23.  
  24. ------------------------------------------------------------------------------
  25. -- Create Font Strings
  26. ------------------------------------------------------------------------------
  27. function XrystalUI_SplashUpdates_OnLoad(self)
  28.     self.ScrollFrame.List = {}
  29.     self.ScrollBar = self.ScrollFrame.ScrollBar
  30.     for i = 1,50 do
  31.         self.ScrollFrame.List[i] = self:CreateFontString(nil,"OVERLAY","XrystalUI_ScrollingText")
  32.         self.ScrollFrame.List[i]:SetWidth(self.ScrollFrame:GetWidth() - 25)
  33.         self.ScrollFrame.List[i]:SetHeight(12)
  34.         if i == 1 then
  35.             self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame,"TOPLEFT",5,-5)
  36.         else
  37.             self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame.List[i - 1],"BOTTOMLEFT",0,0)
  38.         end
  39.         self.ScrollFrame.List[i]:SetJustifyV("TOP")
  40.         self.ScrollFrame.List[i]:SetJustifyH("LEFT")
  41.     end
  42.     self.ScrollBar:SetValue(0) -- go to top
  43.     XrystalUI_SplashScroll_Update(self.ScrollFrame) -- update list
  44. 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:
  1. <Frame parentKey = "Registered Profiles">
  2.                 <Anchors>
  3.                     <Anchor point = "TOP" relativeKey = "$parent.Title" relativePoint = "BOTTOM" x = "0" y = "-5"/>
  4.                     <Anchor point = "BOTTOM" x = "0" y = "5" />
  5.                     <Anchor point = "LEFT" x = "5" y = "0" />
  6.                     <Anchor point = "RIGHT" x = "-30" y = "0" />
  7.                 </Anchors>
  8.                 <Backdrop edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
  9.                     <EdgeSize val="8"/>
  10.                     <TileSize val="8"/>
  11.                     <BackgroundInsets left="0" right="0" top="0" bottom="0"/>
  12.                 </Backdrop>                
  13.                 <Frames>
  14.                    
  15.                     <ScrollFrame name = "$parentScrollFrame" parentKey = "ScrollFrame" inherits = "FauxScrollFrameTemplate">
  16.                         <Anchors>
  17.                             <Anchor point = "TOPLEFT" x = "0" y = "-5" />
  18.                             <Anchor point = "BOTTOMRIGHT" x = "-25" y = "5" />
  19.                         </Anchors>
  20.                         <Scripts>
  21.                             <OnShow>
  22.                                 XrystalUI_ProfileList_Update(self)
  23.                             </OnShow>
  24.                             <OnVerticalScroll>
  25.                                 FauxScrollFrame_OnVerticalScroll(self,offset,12, XrystalUI_ProfileList_Update)
  26.                             </OnVerticalScroll>
  27.                         </Scripts>
  28.                     </ScrollFrame>
  29.                    
  30.                 </Frames>
  31.                 <Scripts>
  32.                     <OnLoad>
  33.                         XrystalUI_ProfileList_OnLoad(self)
  34.                     </OnLoad>
  35.                 </Scripts>
  36.             </Frame>

Lua Code:
  1. ------------------------------------------------------------------------------
  2. -- Scroll Frame Update Routine
  3. ------------------------------------------------------------------------------
  4. function XrystalUI_ProfileList_Update(self)
  5.     local offset = FauxScrollFrame_GetOffset(self)
  6.     FauxScrollFrame_Update(self,50,1,12)
  7.     self.List = self.List or {}
  8.     if #self.List == 0 then return end
  9.     if not addonData.profileManager then return end
  10.     local profiles = addonData.profileManager:ListProfiles()
  11.     if not profiles then return end
  12.     for i = 1,16 do
  13.         local idx = offset + i
  14.         if idx < 50 + 1 and profiles[idx] then
  15.             self.List[i]:SetText("Content " .. idx)--(profiles[idx])
  16.             self.List[i]:Show()
  17.         else
  18.             self.List[i]:SetText("Empty " .. idx)--("")
  19.             self.List[i]:Show()
  20.         end
  21.         self.List[i]:SetText("Something " .. idx)
  22.         self.List[i]:Show()
  23.     end
  24. end
  25.  
  26. ------------------------------------------------------------------------------
  27. -- Scroll Frame OnLoad Routine
  28. ------------------------------------------------------------------------------
  29. function XrystalUI_ProfileList_OnLoad(self)
  30.     self.ScrollFrame.List = {}
  31.     self.ScrollBar = self.ScrollFrame.ScrollBar
  32.     for i = 1,50 do
  33.         self.ScrollFrame.List[i] = self:CreateFontString(nil,"OVERLAY","XrystalUI_ScrollingText")
  34.         self.ScrollFrame.List[i]:SetWidth(self.ScrollFrame:GetWidth() - 25)
  35.         self.ScrollFrame.List[i]:SetHeight(12)
  36.         if i == 1 then
  37.             self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame,"TOPLEFT",5,-5)
  38.         else
  39.             self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame.List[i - 1],"BOTTOMLEFT",0,0)
  40.         end
  41.         self.ScrollFrame.List[i]:SetJustifyV("TOP")
  42.         self.ScrollFrame.List[i]:SetJustifyH("LEFT")
  43.     end
  44.     self.ScrollBar:SetValue(0) -- go to top
  45.     XrystalUI_ProfileList_Update(self.ScrollFrame) -- update list
  46. 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:
  1. <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/">
  2.  
  3.     <Include file = "Templates/Fonts.xml" />
  4.    
  5.     <FontString name = "XrystalUI_ScrollingText" parentArray = "List" inherits = "XrystalUI_Font_08" text = "" virtual = "true">
  6.         <Anchors>
  7.             <Anchor point = "TOPLEFT" x = "0" y = "2" />
  8.         </Anchors>
  9.         <Color r = "1.00" g = "1.00" b = "1.00" />
  10.     </FontString>
  11.    
  12. </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.
__________________
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » FauxScrollFrame Issues

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off