View Single Post
09-16-12, 12:29 AM   #18
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
The parent frame must actually be a frame. You are currently passing ClassIcons, which is a table, not a frame. Similarly, you cannot use SetPoint to position things relative to a table, because a table does not have any position or of the other "physical" attributes a frame has.

The easiest solution would be to make ClassIcons a frame, like the combo point holder is:

Code:
local noop = function() return end

lib.genHoly = function(self)
	if select(2, UnitClass("player")) ~= "PALADIN" then return end

	local ClassIcons = CreateFrame("Frame", nil, self)
	ClassIcons:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 7)
	ClassIcons:SetSize(140, 20) -- 5 icons * 20 width + 4 spaces * 10 width

	-- Optional, to match the combo points:
	bars:SetBackdrop(backdrop)
	bars:SetBackdropBorderColor(0,0,0,0)
	bars:SetBackdropColor(0,0,0,0)

	for i = 1, 5 do
		local Icon = CreateFrame("StatusBar", nil, ClassIcons)
		Icon:SetSize(20, 20)

		-- You do not need a SetPoint line here, because you have some
		-- later that just override the one that was here.	

		Icon:SetStatusBarTexture(config.statusbar_texture)
		Icon:GetStatusBarTexture():SetHorizTile(false)

		Icon:SetBackdrop(backdrop)
		Icon:SetBackdropColor(0,0,0,1)

		-- Map the method oUF tries to call to one that actually exists:
		Icon.SetVertexColor = noop

		if i == 1 then
			Icon:SetPoint("LEFT", ClassIcons)
		else
			Icon:SetPoint("LEFT", ClassIcons[i-1], "RIGHT", 10, 0)
		end
		ClassIcons[i] = Icon
	end

	ClassIcons.PostUpdate = HolyPostUpdate
	self.ClassIcons = ClassIcons
end
__________________
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