View Single Post
07-14-20, 03:21 PM   #1
ApocalypseToast
A Murloc Raider
Join Date: Jul 2020
Posts: 7
Making An itemLink Interactive/Clickable and Show Tooltip

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.

Last edited by ApocalypseToast : 07-14-20 at 03:29 PM.
  Reply With Quote