View Single Post
10-31-16, 04:13 AM   #32
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
That means it's only receiving the "self" argument, without any information about the link. You'll have to keep track of that yourself:

Code:
        local lastLink, lastText, useGameTooltip

        local function OnHyperlinkEnter(frame, link, text)
            lastLink, lastText, useGameTooltip = link, text, showLinkType[link:match("(%a+):%d+")]
            if useGameTooltip then
                GameTooltip:SetOwner(ChatFrame1Tab, "ANCHOR_TOPLEFT", 20, 20)
                GameTooltip:SetHyperlink(link)
                GameTooltip:Show()
            elseif useGameTooltip == false then
                -- Uses a special tooltip, just let the default function handle it.
                SetItemRef(link, text, "LeftButton", frame)
            end
        end
     
        local function OnHyperlinkLeave(frame)
            if useGameTooltip then
                GameTooltip:Hide()
            elseif useGameTooltip == false then
                -- Uses a special tooltip, just let the default function handle it.
                SetItemRef(lastLink, lastText, "LeftButton", frame)
            end
            lastLink, lastText, lastLinkIsNormal = nil, nil, nil
        end
Green lines are new. Yellow lines are changed. A few lines were removed, too. (On a side note, you can just do "if X then" instead of "if X == true then" if your only need to to make sure X isn't false or nil.)
__________________
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.

Last edited by Phanx : 10-31-16 at 04:17 AM.
  Reply With Quote