View Single Post
12-24-13, 12:10 AM   #16
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by 10leej View Post
ok So got everything about setup for the most part but I keep getting this error with the Eclipse bar.
The example in oUF\elements\eclipsebar.lua is wrong. The EclipseBar object cannot be a plain table like that -- it must either be a frame (so it has native :Show() and :Hide() methods) or you must manually emulate those methods by adding functions to the table yourself. I'd just make it a frame.

Also, you are parenting your lunar power bar to your mana bar, but parenting your solar power bar to your frame. You should parent them both to the same object (preferrably the EclipseBar element frame, which itself should be parented directly to your unit frame):

Code:
local EclipseBar = CreateFrame("Frame", nil, self)
EclipseBar:SetPoint("TOP", Power, "BOTTOM", 0, -2) -- are you sure you want this overlapping your power bar by 2px?
EclipseBar:SetSize(width, 10)
self.EclipseBar = EclipseBar

local LunarBar = CreateFrame("StatusBar", nil, EclipseBar)
LunarBar:SetPoint("LEFT")
LunarBar:SetSize(width, 10)
EclipseBar.LunarBar = LunarBar

local SolarBar = CreateFrame("StatusBar", nil, EclipseBar)
SolarBar:SetPoint("LEFT", EclipseBar:GetStatusBarTexture(), "RIGHT")
SolarBar:SetSize(width, 10)
EclipseBar.SolarBar = SolarBar
Originally Posted by 10leej View Post
Also need to figure out how to add the status text.
Status text to what? The eclipse bar? Tags to the rescue!

Code:
local EclipseText = SolarBar:CreateFontString(nil, "OVERLAY", "TextStatusBarText") -- parent to last child to make sure it's on top
EclipseText:SetPoint("CENTER", EclipseBar) -- but anchor to the base element so it doesn't wiggle
self:Tag(EclipseText, "[pereclipse]") -- oUF will automagically update it!
EclipseBar.text = EclipseText
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote