View Single Post
05-14-21, 12:43 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
I think you'd be better explaining more of what you are wanting to do with the fontstrings after they are created. From what you've posted it seems like you are thinking you have to create a new frontstring every time you want to display something different whereas you only need to create a fonstring once and there after, just change the text it displays.

eg.

Lua Code:
  1. local f = CreateFrame("Frame", nil, UIParent)
  2. f:SetSize(5, 5)
  3. f:SetPoint("LEFT", 10, 0)
  4. f.FontStrings = {}
  5. for i=1, 20 do
  6.     -- add a fontstring to the f.FontStrings table so we can re-use them as required
  7.     tinsert(f.FontStrings, f:CreateFontString(nil, "OVERLAY", "GameTooltipText"))
  8.     -- set them up in a column for demonstration purposes
  9.     if i == 1 then
  10.         f.FontStrings[i]:SetPoint("LEFT")
  11.     else
  12.         f.FontStrings[i]:SetPoint("TOPLEFT", f.FontStrings[i-1], "BOTTOMLEFT", 0, -1)
  13.     end
  14. end
  15.  
  16. -- set the initial texts (which could also be done after creating the fontstring but this is for demonstration.
  17. for i=1, #f.FontStrings do
  18.     f.FontStrings[i]:SetText("Entry"..i)
  19. end
  20. -- Some time later you might need to change your displayed texts too:
  21.  
  22. for i=1, #f.FontStrings do
  23.     f.FontStrings[i]:SetText("Exit"..i)
  24. end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-14-21 at 01:11 AM.
  Reply With Quote