View Single Post
02-28-16, 04:56 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Fizzlemizz View Post
That said, even adding a third "background" bar to anchor the icon and statusbar too to then centre, you would sill need to calculate the width of the icon and bar to centre the anchor properly.
Not necessarily.

Lua Code:
  1. local anchor = CreateFrame("Frame", nil, UIParent)
  2. anchor:SetWidth(300)
  3. anchor:SetHeight(40)
  4. anchor:SetPoint("CENTER")
  5.  
  6. local icon = anchor:CreateTexture()
  7. icon:SetWidth(38)
  8. icon:SetHeight(38)
  9. icon:SetPoint("TOPLEFT", anchor, "TOPLEFT", 1, -1)
  10.  
  11. local sbar = CreateFrame("StatusBar", nil, anchor)
  12. sbar:SetHeight(38)
  13. sbar:SetPoint("TOPRIGHT", anchor, "TOPRIGHT", -1, -1)
  14. sbar:SetPoint("TOPLEFT", icon, "TOPRIGHT", 1, 0)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote