Thread Tools Display Modes
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,877
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
05-25-20, 12:57 PM   #2
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
I haven't figured out exactly what your issue is yet - but I will point out things that I see.


In OnLoad you are creating too many fontstrings. The whole point of FauxScrollFrame is that only the visible items have widgets assoicated with them. It is like a window on your data

So this doesn't seem ritght

Lua Code:
  1. for i = 1,50 do
  2.         self.ScrollFrame.List[i] = self:CreateFontString(nil,"OVERLAY","XrystalUI_ScrollingText")

What you should be doing in your update is iterating over FauxScrollFame's list of items, and changing them to suit where your current window into the data is.

So lets see how big your window is.

According to what you tell FauxScrollFrame here

Lua Code:
  1. FauxScrollFrame_Update(self,50,1,12)

Here's the signature:

Lua Code:
  1. function FauxScrollFrame_Update(frame, numItems, numToDisplay, buttonHeight, button, smallWidth, bigWidth, highlightFrame, smallHighlightWidth, bigHighlightWidth, alwaysShowScrollBar)


You have 50 data items, and you want to show 1 item at a time.

So there is an issue.

So what you are supposed to do in your Update function, is get the offset, and use that as the starting position in your data array, then you iterate over the FauxScrollFrame's items, and set them to show what is in your data array. That way you don't have to create 50+ fontstrings.

I don't currently see the connection between your fontstrings and the FauxScrollFrame's items.

Whatever the number you pass as the numToDisplay parameter is the number of fontstrings you should create. Don't create any more than that.

What people normally do is define a constant NUM_DISPLAY_ITEMS, then use that to create the items, and to pass in the Update method

Hope that helps!

Last edited by sylvanaar : 05-25-20 at 01:14 PM.
  Reply With Quote
05-25-20, 02:44 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Hmm thanks for the info on
FauxScrollFrame_Update(self,50,1,12)
I can't remember now where I got the code that helped me way back on the first module. So can't explain why it is written this way now.

Aha, this is where I got that code from.
https://wowwiki.fandom.com/wiki/Maki...lFrameTemplate

I can't imagine why I used 1 .. unless I thought it meant how many lines per entry. It was a long while ago so that reasoning is foggy I am afraid... anyway I will look over it again and make sure the values are what I expect. Based on my usage it should be something along the lines of :
50 max items in the Data List. 16 or however many it lets me fit into the area I want to use as the display, and 12 as the height of the line. Creating the fontstring should use the display count, update loop should use the display count, but use the list count to know whether I have reached the end of the list.

I don't currently see the connection between your fontstrings and the FauxScrollFrame's items.

The FontString template used in the fontstring creation has a parentKey of List. It is parented to the ScrollFrame ( self.ScrollFrame in the functions ).



However, the problem I was having is that one frame works and the other doesn't even though they are literally copy and paste xml and lua code blocks with just the main frame names and array names changed accordingly.

Maybe the problem is that on the profile list in the options screen I only have 1 item .. maybe that is too few for it to work .. 50,1,12 should have worked regardless of how many I was creating as I only had 1 item to display. But 50,1,12 also allowed me to display 6 items on the screen... so maybe that value isn't set in stone and the items will still display regardless as I have a 1,50 loop being used.


Anyway, thanks again, and I will take another look and maybe setting it to what it should be may solve the problem I am having somehow .. I hate those types of solutions but I can't complain if it does work rofl.
__________________
  Reply With Quote
05-25-20, 03:06 PM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Unfortunately, changing the loop counter to 16 and the FauxScrollFrame_Update parameters to 50,16,12 didn't make a blind bit of difference.


The Splash screen is still showing it's 6 items as before, no difference whatsoever. And the profile screen is still showing nother except the scrollbar and the scroll frame border. None of the individual text lines on the profile are showing at all.


This is now the changed blocks of code:
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,16,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.         print(self.List[i]:GetText()) -- This display's "Content 1" and then several lines of "Empty x"
  22.     end
  23. end
  24.  
  25. ------------------------------------------------------------------------------
  26. -- Scroll Frame OnLoad Routine
  27. ------------------------------------------------------------------------------
  28. function XrystalUI_ProfileList_OnLoad(self)
  29.     self.ScrollFrame.List = {}
  30.     self.ScrollBar = self.ScrollFrame.ScrollBar
  31.     for i = 1,16 do
  32.         self.ScrollFrame.List[i] = self:CreateFontString(nil,"OVERLAY","XrystalUI_ScrollingText")
  33.         self.ScrollFrame.List[i]:SetWidth(self.ScrollFrame:GetWidth() - 25)
  34.         self.ScrollFrame.List[i]:SetHeight(12)
  35.         if i == 1 then
  36.             self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame,"TOPLEFT",5,-5)
  37.         else
  38.             self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame.List[i - 1],"BOTTOMLEFT",0,0)
  39.         end
  40.         self.ScrollFrame.List[i]:SetJustifyV("TOP")
  41.         self.ScrollFrame.List[i]:SetJustifyH("LEFT")
  42.     end
  43.     self.ScrollBar:SetValue(0) -- go to top
  44.     XrystalUI_ProfileList_Update(self.ScrollFrame) -- update list
  45. end

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,16,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,16 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

As you can see they are almost identical. So, should work in an almost identical manner but it doesn't.

Could this be caused by how the Options screen works with those special config panel functions ?

Lua Code:
  1. ------------------------------------------------------------------------------
  2. -- Define the config frame
  3. ------------------------------------------------------------------------------
  4. function XrystalUI_Config_ProfileManager_OnLoad(panel)
  5.  
  6.     -- Set the name for the Category for the Panel
  7.     panel.name = addonData.Translate("Profile Manager")
  8.  
  9.     -- the panel.name value of the parent configuration panel, used to display a hierarchical category tree.
  10.     -- If the parent panel is not specified or does not exist, the panel is displayed as a top-level panel
  11.     panel.parent = XrystalUI_Options.name
  12.    
  13.     -- called when the player presses the Okay button, indicating that settings should be saved.
  14.     panel.okay = function(self) ClosePanel(self) end
  15.  
  16.     -- called when the player presses the Cancel button, indicating that changes made should be discarded
  17.     panel.cancel = function(self)  CancelOrLoadPanel(self)  end
  18.  
  19.     -- called when the frame is initially displayed, and after requesting the default values to be restored
  20.     panel.refresh = function(self) RefreshPanel(self) end
  21.    
  22.     -- called when the player presses the Defaults button, indicating that default settings for the addon should be restored
  23.     panel.default = function(self) DefaultPanel(self) end
  24.    
  25.     -- Add the panel to the Interface Options
  26.     InterfaceOptions_AddCategory(panel)
  27.    
  28. end

Panel Functions - At present only the title is updated .. I tried updating the Scroll Frame here but it didn't make a difference either.
Lua Code:
  1. local function ClosePanel(panel)
  2.     UpdateVariables(panel)
  3. end
  4.  
  5. local function CancelOrLoadPanel(panel)
  6. end
  7.  
  8. local function RefreshPanel(panel)
  9.     panel.Title:SetText(addonData.Translate("Profile Manager"))
  10. end
  11.  
  12. local function DefaultPanel(panel)
  13. end
__________________
  Reply With Quote
05-25-20, 03:06 PM   #5
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
So I would define

Lua Code:
  1. local NUM_DISPLAY_LINES = 16
  2. local NUM_TOTAL_LINES = 50


Then in OnLoad

Lua Code:
  1. for i = 1,NUM_DISPLAY_LINES do
  2.         self.ScrollFrame.List[i] = self:CreateFontString(nil,"OVERLAY","XrystalUI_ScrollingText")


And In update:


Lua Code:
  1. function XrystalUI_SplashScroll_Update(self)
  2.     local offset = FauxScrollFrame_GetOffset(self)
  3.     FauxScrollFrame_Update(self,NUM_TOTAL_LINES ,NUM_DISPLAY_LINES ,12)
  4.     self.List = self.List or {}
  5.     if #self.List == 0 then return end
  6.     if not addonData.versionHistory then return end
  7.     local versionHistory = addonData.versionHistory
  8.     if not versionHistory then return end
  9.     for i = 1,NUM_DISPLAY_LINES  do
  10.         local idx = offset + i
  11.         if idx <= NUM_TOTAL_LINES  and versionHistory[idx] then
  12.             self.List[i]:SetText(versionHistory[idx].Version .. " : " .. versionHistory[idx].Content)
  13.             self.List[i]:Show()
  14.         else
  15.             self.List[i]:SetText("")
  16.             self.List[i]:Hide()
  17.         end
  18.     end
  19. end
  Reply With Quote
05-25-20, 03:26 PM   #6
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Yes, I probably will at some point .. I need to get it working like the other one works first though.

Tried looking at
https://www.townlong-yak.com/framexm..._BindingUI.lua
and
https://www.townlong-yak.com/framexm..._BindingUI.xml

As that is the nearest to what I am doing but the code is considerably more different to mine to see what they are doing different than me .. outside of the whole frame rofl.


SplashScroll works fine... fonts are visible with no additional effort.
ProfileList doesn't show the text .. it scrolls, the fontstrings are created, they just aren't visible .. on this frame. so why not ????

Hopefully these images will explain what I mean

Splash Screen Image


Profile List Output Image



Confused.com rofl
__________________

Last edited by Xrystal : 05-25-20 at 03:41 PM.
  Reply With Quote
05-25-20, 06:49 PM   #7
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
Yeah. I can't see it from the code that you have shown. If you have a repo - post a link
  Reply With Quote
05-25-20, 07:37 PM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Originally Posted by sylvanaar View Post
Yeah. I can't see it from the code that you have shown. If you have a repo - post a link

I don't have a repo .. but have uploaded it to the project on here for it.

https://www.wowinterface.com/downloa...velopment.html

It's going to be a big project but the code you need to look at are the Features/Profiles and Features/Splash folders apart from the main addon files the rest shouldn't have any direct involvement with the files.
__________________
  Reply With Quote
05-25-20, 09:44 PM   #9
sezz
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 158
self.ScrollFrame:GetWidth() returns 0 in XrystalUI_ProfileList_OnLoad, you can use anchors instead:

Lua Code:
  1. function XrystalUI_ProfileList_OnLoad(self)
  2.     self.ScrollFrame.List = {}
  3.     self.ScrollBar = self.ScrollFrame.ScrollBar
  4.     for i = 1,16 do
  5.         self.ScrollFrame.List[i] = self:CreateFontString(nil,"OVERLAY","XrystalUI_ScrollingText")
  6.         self.ScrollFrame.List[i]:SetHeight(20)
  7.         if i == 1 then
  8.             self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame,"TOPLEFT",5,-5)
  9.             self.ScrollFrame.List[i]:SetPoint("TOPRIGHT",self.ScrollFrame,"TOPRIGHT",-5,-5)
  10.         else
  11.             self.ScrollFrame.List[i]:SetPoint("TOPLEFT",self.ScrollFrame.List[i - 1],"BOTTOMLEFT")
  12.             self.ScrollFrame.List[i]:SetPoint("TOPRIGHT",self.ScrollFrame.List[i - 1],"BOTTOMRIGHT")
  13.         end
  14.         self.ScrollFrame.List[i]:SetJustifyV("TOP")
  15.         self.ScrollFrame.List[i]:SetJustifyH("LEFT")
  16.     end
  17.     self.ScrollBar:SetValue(0) -- go to top
  18.     XrystalUI_ProfileList_Update(self.ScrollFrame) -- update list
  19. end
  Reply With Quote
05-25-20, 09:51 PM   #10
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
Your fontstrings aren't fully anchored. They only have 1 point anchored TOPLEFT.

They should also anchor on the right side of the scrollframe

Code:
        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]:SetPoint("RIGHT",self.ScrollFrame)
  Reply With Quote
05-25-20, 11:15 PM   #11
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
hmm, they have their width and height set at time of creation, to go with the anchors so should have worked together. I'll have to take another look to see of i messed that part up on the profilr part of the code.

Thanks.
__________________
  Reply With Quote
05-26-20, 06:38 AM   #12
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Thanks for that independent view of the code.I clearly didn't think outside of the box enough on this one rofl.

As I suspected, that can't be the reason one works and the other doesn't. Both scroll frames have access to the same template with the initial TOPLEFT anchor.

When the fontstrings are created BOTH scroll frames specify the height and width based on the container they are in. This is supposed to be the equivalent of specifying a TOPLEFT and BOTTOMRIGHT anchor system.

However, seeing as I assume it worked, I made the change anyway .. as follows:

Lua Code:
  1. <FontString name = "XrystalUI_ScrollingText" parentArray = "List" inherits = "XrystalUI_Font_08" text = "Scrolling Text" virtual = "true">
  2.         <Anchors>
  3.             <Anchor point = "TOPLEFT" x = "0" y = "-2" />
  4.             <Anchor point = "TOPRIGHT" x = "-25" y = "-2" />
  5.         </Anchors>
  6.         <Color r = "1.00" g = "1.00" b = "1.00" />
  7.     </FontString>

This seems to work as expected.

I can't understand why the Splash Screen worked without the change and the Profile List worked after the change ( without affecting the Splash Screen ). I double checked the code yet again in case I missed something connected to the anchoring and sizing system but nada .. they were identical. The only difference is that the Profile List is being housed into another frame created by Blizzard which may not be definied in the same way the UIParent is that my Splash Screen sits on. I will have to remember to bear that in mind when something similar crops up.

The question will always remain with why one worked and the other didn't... the mystery still exists. But at least it works now, so thanks.
__________________
  Reply With Quote
05-26-20, 08:37 AM   #13
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
Originally Posted by Xrystal View Post
Thanks for that independent view of the code.I clearly didn't think outside of the box enough on this one rofl.

As I suspected, that can't be the reason one works and the other doesn't. Both scroll frames have access to the same template with the initial TOPLEFT anchor.

When the fontstrings are created BOTH scroll frames specify the height and width based on the container they are in. This is supposed to be the equivalent of specifying a TOPLEFT and BOTTOMRIGHT anchor system.

However, seeing as I assume it worked, I made the change anyway .. as follows:

Lua Code:
  1. <FontString name = "XrystalUI_ScrollingText" parentArray = "List" inherits = "XrystalUI_Font_08" text = "Scrolling Text" virtual = "true">
  2.         <Anchors>
  3.             <Anchor point = "TOPLEFT" x = "0" y = "-2" />
  4.             <Anchor point = "TOPRIGHT" x = "-25" y = "-2" />
  5.         </Anchors>
  6.         <Color r = "1.00" g = "1.00" b = "1.00" />
  7.     </FontString>

This seems to work as expected.

I can't understand why the Splash Screen worked without the change and the Profile List worked after the change ( without affecting the Splash Screen ). I double checked the code yet again in case I missed something connected to the anchoring and sizing system but nada .. they were identical. The only difference is that the Profile List is being housed into another frame created by Blizzard which may not be definied in the same way the UIParent is that my Splash Screen sits on. I will have to remember to bear that in mind when something similar crops up.

The question will always remain with why one worked and the other didn't... the mystery still exists. But at least it works now, so thanks.

Could be that XrystalUI_Splash has a size and an anchor point, while XrystalUI_Config_ProfileManager does not. This could lead to the 0 width problem you observed.

Lua Code:
  1. <Frame name="XrystalUI_Splash" hidden = "false">
  2.         <Size x = "500" y = "300" />
  3.         <Anchors>
  4.             <Anchor point = "CENTER" />
  5.         </Anchors>
  Reply With Quote
05-26-20, 09:14 AM   #14
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Originally Posted by sylvanaar View Post
Could be that XrystalUI_Splash has a size and an anchor point, while XrystalUI_Config_ProfileManager does not. This could lead to the 0 width problem you observed.

Lua Code:
  1. <Frame name="XrystalUI_Splash" hidden = "false">
  2.         <Size x = "500" y = "300" />
  3.         <Anchors>
  4.             <Anchor point = "CENTER" />
  5.         </Anchors>

XrystalUI_Splash plugs into UIParent and is the equivalent of XrystalUI_Config_ProfileManager which plugs into Blizzards Config system. As far as I know you don't specify any anchors or sizes as Blizzard does the work for you as soon as you tell it to add it to the Config system.

It does appear that the problem is due to how the two systems work. The example from Blizzard doesn't include anchors etc on their guide to using it on the beta code ..
https://github.com/tomrus88/Blizzard...tionsFrame.lua Which would confuse things.

However, https://wow.gamepedia.com/Using_the_...s_Addons_panel does specify that FrameXML will reposition it and not resize it, which is what I assume it did, resize it to fit into their main panel.

Lua Code:
  1. function XrystalUI_Config_ProfileManager_OnLoad(panel)
  2.  
  3.     -- Set the name for the Category for the Panel
  4.     panel.name = addonData.Translate("Profile Manager")
  5.  
  6.     -- the panel.name value of the parent configuration panel, used to display a hierarchical category tree.
  7.     -- If the parent panel is not specified or does not exist, the panel is displayed as a top-level panel
  8.     panel.parent = XrystalUI_Options.name
  9.    
  10.     -- called when the player presses the Okay button, indicating that settings should be saved.
  11.     panel.okay = function(self) ClosePanel(self) end
  12.  
  13.     -- called when the player presses the Cancel button, indicating that changes made should be discarded
  14.     panel.cancel = function(self)  CancelOrLoadPanel(self)  end
  15.  
  16.     -- called when the frame is initially displayed, and after requesting the default values to be restored
  17.     panel.refresh = function(self) RefreshPanel(self) end
  18.    
  19.     -- called when the player presses the Defaults button, indicating that default settings for the addon should be restored
  20.     panel.default = function(self) DefaultPanel(self) end
  21.    
  22.     -- Add the panel to the Interface Options
  23.     InterfaceOptions_AddCategory(panel)
  24.    
  25. end

Oh well, it works now, and at least I can walk away knowing that the mystery is solved. I may end up hitting it again down the line so hopefully I will come across this post which will remind me why following the examples didn't work rofl. But seeing as I usually copy from an existing addon of mine that I know does what I want rofl .. it shouldn't be a problem anymore rofl.


Anyway thanks again.
__________________
  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