(This is my full lua code for this lua, it just deletes the repetitious bits such as additional uses of CreateBoxes() in WNCFrame_Load())
I'm having a strange problem and hope someone can help..
If I populate a the created field in CreateBoxes.. if I populate it inside create boxes, like the commented out #16, it works and populates fine and is clickable properly.
However if I populate it after, for instance in the EventFrame event-- effectively On-UPDATE_MOUSEOVER_UNIT--the box updates and the link shows properly but is not clickable.
lua Code:
local thisType = ""
local _G = getfenv()
function WNCFrame_Load()
CreateBoxes("DK")
end
function CreateBoxes(wnc_boxname)
_G["info"..wnc_boxname]=CreateFrame("SimpleHTML","testaddon_Frame",WNCFrame); --creates the frame
_G["info"..wnc_boxname]:SetWidth(174); _G["info"..wnc_boxname]:SetHeight(40); --sets frame dimensions
_G["info"..wnc_boxname]:SetFontObject("SystemFont_Tiny"); --tells the frame to copy the styling from fontobject "GameFontNormal"
_G["info"..wnc_boxname]:SetJustifyH("LEFT"); --tells the frame to left-justify text
_G["info"..wnc_boxname]:SetJustifyV("TOP");
_G["info"..wnc_boxname]:SetScript("OnHyperlinkClick", function(self, ...) ChatFrame_OnHyperlinkShow(...) end); --tells the frame to use the default hyperlink "OnClick" action
_G["info"..wnc_boxname]:SetPoint("TOPLEFT",_G["label"..wnc_boxname],"BOTTOMLEFT"); --anchors the frame to the left edge of the screen
_G["info"..wnc_boxname]:SetText("\124cff71d5ff\124Hspell:45524\124h[Chains of Ice]\124h\124r");
end
local EventFrame = CreateFrame("Frame")
EventFrame:RegisterEvent("UPDATE_MOUSEOVER_UNIT")
EventFrame:SetScript("OnEvent", function(self,event,...)
thisType = UnitCreatureType("mouseover")
ChatFrame1:AddMessage(_G["data"..thisType..".DK"]);
_G["infoDK"]:SetText("\124cff71d5ff\124Hspell:339\124h[Entangling Roots]\124h\124r");
end)