Quantcast WoWInterface - View Single Post - resize frame to fit text
View Single Post
06-22-13, 12:20 AM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,726
The way to make it work by anchoring is to create the frame first, then the fontstring, both with anchors not set yet. Instead of the conventional anchor fontstring to frame and frame to parent, you do the reverse. Anchor the frame to the fontstring and the fontstring to the frame's parent.

Lua Code:
  1. local Frame=CreateFrame("Frame",nil,UIParent);
  2. local Text=Frame:CreateFontString(nil,"OVERLAY","GameFontNormal");
  3.  
  4. Frame:SetAllPoints(Text);-- Set points for frame
  5. Text:SetPoint("CENTER",UIParent,"CENTER",0,0);--    Move text to location
__________________
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote