Hello.
I've got an oGlow-ish script in my UI which colours item borders according to quality. I'm trying to get it to work on the inspect frame and it works fine, however, when switching targets while the inspect frame is open, it won't update. It does update though if you close the inspect frame, switch target, and then reopen it.
Here's the relevant stuff:
Code:
local function UpdateGlow(button, id)
local quality, texture, _
if(id) then
quality, _, _, _, _, _, _, texture = select(3, GetItemInfo(id))
end
local glow = button.glow
if(not glow) then
glow = CreateFrame("Frame", nil, button)
glow:SetBackdrop({
bgFile = "",
edgeFile = FreeUI.backdrop,
edgeSize = 1,
insets = {left = 0, right = 0, top = 0, bottom = 0},
})
glow:SetPoint("TOPLEFT", button, "TOPLEFT", -1, 1)
glow:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", 1, -1)
button.glow = glow
end
if(texture) then
local r, g, b = GetItemQualityColor(quality)
if(r==1) then r, g, b = 0, 0, 0 end
glow:SetBackdropBorderColor(r, g, b)
glow:Show()
else
glow:Hide()
end
end
Code:
local updateinspect = function(self)
local unit = InspectFrame.unit
if InspectFrame:IsShown() then
for key, slotName in ipairs(slots) do
local slotID = key % 20
local slotFrame = _G["Inspect"..slotName.."Slot"]
local slotLink = GetInventoryItemLink(unit, slotID)
UpdateGlow(slotFrame, slotLink)
end
end
end
local g = CreateFrame("Frame")
g:RegisterEvent("ADDON_LOADED")
g:SetScript("OnEvent", function(self, event, addon)
if addon == "Blizzard_InspectUI" then
InspectFrame:HookScript("OnShow", updateinspect)
g:RegisterEvent("PLAYER_TARGET_CHANGED", updateinspect)
--[[g:RegisterEvent("INSPECT_READY", updateinspect)
g:RegisterEvent("UNIT_INVENTORY_CHANGED", function(self, event, unit)
if(InspectFrame.unit == unit) then
updateinspect()
end
end)]]
g:UnregisterEvent("ADDON_LOADED")
end
end)
I tried a couple of different things. The commented out part doesn't really seem to change anything noticeable.
Does anyone have any suggestions? They'd be appreciated.