I am working on an addon for my raid leader. I can generate a frame that shows a list of all loot picked up off a boss and the name of the character that picked it up. Next step I want to take is make that item link clickable to show the item tooltip like it does in the chat window (or better yet show it on mouseover).
Code:
-- code I found online to generate an item link from equipped mainhand weapon
local mainHandLink = GetInventoryItemLink("player",GetInventorySlotInfo("MainHandSlot"))
local _, itemLink, _, _, _, _, itemType = GetItemInfo(mainHandLink)
-- send it to chat window to test it works and it does, you can click it in the window and see the item
DEFAULT_CHAT_FRAME:AddMessage(itemLink)
-- make link frame, would be a subset of another frame later
CreateFrame("Frame", "LinkFrame", UIParent)
LinkFrame:SetPoint("CENTER", 0, 200)
LinkFrame:SetSize(200,100)
LinkFrame:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\PVPFrame\\UI-Character-PVP-Highlight", -- this one is neat
edgeSize = 16,
insets = { left = 8, right = 6, top = 8, bottom = 8 },
})
-- fonstring with item
ItemLinkText = LinkFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
ItemLinkText:SetText(itemLink)
ItemLinkText:SetPoint("CENTER")
LinkFrame:EnableMouse(true)
-- not sure what else code I am missing to make the link 'clickable'
I've looked and tried various things but nothing has worked. Didn't include it here so it is more clear what I am looking for.