Quantcast
[Classic] Create & show tooltip - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-26-21, 09:25 AM   #1
MinguasBeef
A Cyclonian
AddOn Author - Click to view addons
Join Date: May 2019
Posts: 47
[Classic] Create & show tooltip

I'm working on my own unit frames.

I want to show a tooltip for the buff at index 1 when I mouse over my frame. I am not seeing anything, however.

Wrote up a simple example to see what i'm doing.

Code:
local f = CreateFrame("Frame", "TestFrame", UIParent)
f:SetWidth(100)
f:SetHeight(100)
f:SetPoint("CENTER")
f.texture = f:CreateTexture("Texture", "Background")
f.texture:SetColorTexture(0.03, 0.03, 0.03, 0.8)
f.texture:SetAllPoints(f)

local tt = CreateFrame("GameTooltip", "MyTooltip", UIParent, "GameTooltipTemplate")
tt:SetOwner(f, "ANCHOR_RIGHT")
tt:Hide()
   
f:SetScript("OnEnter", function()
    if (UnitBuff("player", 1)) then
        tt:SetUnitBuff("player", 1)
        tt:Show()
    end
end)
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » [Classic] Create & show tooltip

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off