View Single Post
11-13-14, 08:38 PM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Why on earth would you hook CreateFrame for that? >_<

Code:
local Inventorian = LibStub("AceAddon-3.0"):GetAddon("Inventorian")

local function TokenUpdate()
    if GetNumWatchedTokens() > 0 then
        BackpackTokenFrame:SetParent(Inventorian.bag)
        BackpackTokenFrame:ClearAllPoints()
        BackpackTokenFrame:SetPoint("TOPRIGHT", Inventorian.bag, "BOTTOMRIGHT", 0, 4)
        BackpackTokenFrame:Show()
    end
end

hooksecurefunc(Inventorian, "OnEnable", function(self)
   hooksecurefunc(self.bag, "Show", TokenUpdate)
   hooksecurefunc("ManageBackpackTokenFrame", TokenUpdate)
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