Originally Posted by Fizzlemizz
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:
local anchor = CreateFrame("Frame", nil, UIParent)
anchor:SetWidth(300)
anchor:SetHeight(40)
anchor:SetPoint("CENTER")
local icon = anchor:CreateTexture()
icon:SetWidth(38)
icon:SetHeight(38)
icon:SetPoint("TOPLEFT", anchor, "TOPLEFT", 1, -1)
local sbar = CreateFrame("StatusBar", nil, anchor)
sbar:SetHeight(38)
sbar:SetPoint("TOPRIGHT", anchor, "TOPRIGHT", -1, -1)
sbar:SetPoint("TOPLEFT", icon, "TOPRIGHT", 1, 0)