wowpedia
Main Menu


Anchors the tooltip to a temporary owner.

GameTooltip:SetOwner(owner, "anchor"[, ofsX, ofsY]);

Arguments

owner
Frame - The tooltip's temporary owner.
anchor
string - How the tooltip should anchor to the owner or, in special cases, to other locations.
ANCHOR_TOP
:SetPoint("BOTTOM", owner, "TOP")
ANCHOR_RIGHT
:SetPoint("BOTTOMLEFT", owner, "TOPRIGHT")
ANCHOR_BOTTOM
:SetPoint("TOP", owner, "BOTTOM")
ANCHOR_LEFT
:SetPoint("BOTTOMRIGHT", owner, "TOPLEFT")
ANCHOR_TOPRIGHT
:SetPoint("BOTTOMRIGHT", owner, "TOPRIGHT")
ANCHOR_BOTTOMRIGHT
:SetPoint("TOPLEFT", owner, "BOTTOMRIGHT")
ANCHOR_TOPLEFT
:SetPoint("BOTTOMLEFT", owner, "TOPLEFT")
ANCHOR_BOTTOMLEFT
:SetPoint("TOPRIGHT", owner, "BOTTOMLEFT")
ANCHOR_CURSOR
:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", mX - (tooltipWidth / 2), mY) -- where mX and mY are the cursor's X and Y coordinates as returned by GetCursorPosition() divided by the effective scale of UIParent returned by UIParent:GetEffectiveScale().
ANCHOR_PRESERVE
Stays at the position you initially set it to. Subsequent attempts to move the tooltip will be ignored until it's hidden or a new owner is given.
ANCHOR_NONE
No call to :SetPoint() will be made. You must call it manually.[citation needed] 
ofsX
number? - Horizontal offset; positive values move tooltip to the right.
ofsY
number? - Vertical offset; positive values move tooltip up.

Details

Example

A simple tooltip when hovering a frame:

frame:SetScript("OnEnter", function()
	GameTooltip:SetOwner(frame, "ANCHOR_CURSOR")
	GameTooltip:AddLine("Title")
	GameTooltip:AddLine("The second line of text")
	GameTooltip:Show()
end)
frame:SetScript("OnLeave", function()
	GameTooltip:Hide()
end)

See Also