View Single Post
04-18-09, 05:33 AM   #992
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Having a peculiar problem I've never run into before... I've got a "ghost" frame where I've anchored my target that always shows up.



Player on left, but I don't have a target at all (nor have I spawned any other frames) and there's a frame on the right. If I select a target it updates and works fine, but once I deselect it the ghost frame just remains with the last known status of the target.

Code:
--locals


--config
local statusTexture = [=[Interface\AddOns\oUF_Pooch\media\HalF]=]
local flatTexture = [=[Interface\AddOns\oUF_Pooch\media\Flat]=]
local backdrop = {
	bgFile = [=[Interface\ChatFrame\ChatFrameBackground]=],
	insets = {top = -1, left = -1, bottom = 0, right = -1},
}

local height, width = 27, 240

--right-click menu
local function menu(self)
	local unit = string.gsub(self.unit, "(.)", string.upper, 1)
	
	if _G[unit .. "FrameDropDown"] then
		ToggleDropDownMenu(1, nil, _G[unit .. "FrameDropDown"], "cursor")	
	end
end

local function layout(self, unit)
	--enable our right-click menu
	self.menu = menu
	self:RegisterForClicks("AnyUp")
	self:SetAttribute("type2", "menu")
	
	--tooltip stuff
	self:SetScript("OnEnter", UnitFrame_OnEnter)
	self:SetScript("OnLeave", UnitFrame_OnLeave)
	
	--misc frame stuff
	self:SetHeight(height)
	self:SetWidth(width)
	
	self:SetBackdrop(backdrop)
	self:SetBackdropColor(0, 0, 0)
	
	self:SetFrameStrata("LOW")
	
	--creating our status bars
	local hp = CreateFrame("StatusBar")
	hp:SetPoint("TOPRIGHT", self)
	hp:SetPoint("TOPLEFT", self)
	hp:SetStatusBarTexture(statusTexture)
	hp:SetStatusBarColor(.23, .27, .22)
	hp:SetHeight(13)
	hp:SetWidth(width)
	
	self.Health = hp
	self.Health.FrequentUpdates = true
	
	local hpbg = hp:CreateTexture(nil, "BORDER")
	hpbg:SetAllPoints(hp)
	hpbg:SetTexture(statusTexture)
	hpbg:SetVertexColor(.3, .3, .3)
	
	self.Health.bg = hpbg
	

	local power = CreateFrame("StatusBar")
	power:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 0, -1)
	power:SetPoint("TOPRIGHT", self.Health, "BOTTOMRIGHT", 0, -1)
	power:SetStatusBarTexture(flatTexture)
	power:SetStatusBarColor(.51, .5, .34)
	power:SetHeight(3)
	power:SetWidth(width)
	
	local powerbg = power:CreateTexture(nil, "BORDER")
	powerbg:SetAllPoints(power)
	powerbg:SetTexture(.2, .2, .2)
	
	self.Power = power
	self.Power.FrequentUpdates = true
end

oUF:RegisterStyle("Pooch", layout)
oUF:SetActiveStyle("Pooch")

oUF:Spawn("player", "oUF_Player"):SetPoint("CENTER", UIParent, "CENTER", -300, 0)
oUF:Spawn("target", "oUF_Target"):SetPoint("CENTER", UIParent, "CENTER", 300, 0)
Obviously 90% incomplete but I wanted to fix this before digging myself a deeper hole.

edit: I've also ruled out oUF itself as a problem since other layouts work fine.