API GameTooltip SetOwner
Moves the game tooltip to a location based on the "owner" frame.
GameTooltip:SetOwner(owner, "anchor"[, ofsX, ofsY]);
- Frame - Owner frame, which defines the element where the tooltip is centered on. A pointer to the frame is required, not the frame name itself (use _G[frameName] to get the pointer from the frame name assuming it's in the global scope).
- String - a string that describes the anchor point as it would be set via the :SetPoint() function. Anchoring methods as follows:
- :SetPoint("BOTTOM", owner, "TOP")
- :SetPoint("BOTTOMLEFT", owner, "TOPRIGHT")
- :SetPoint("TOP", owner, "BOTTOM")
- :SetPoint("BOTTOMRIGHT", owner, "TOPLEFT")
- :SetPoint("BOTTOMRIGHT", owner, "TOPRIGHT")
- :SetPoint("TOPLEFT", owner, "BOTTOMRIGHT")
- :SetPoint("BOTTOMLEFT", owner, "TOPLEFT")
- :SetPoint("TOPRIGHT", owner, "BOTTOMLEFT")
- :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().
- 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.
- No call to :SetPoint() will be made. You must call it manually.
- Number (optional) - Horizontal offset; positive values move tooltip to the right.
- Number (optional) - Vertical offset; positive values move tooltip up.
- This will set the owner of the tooltip. E.g. tooltip:IsOwned(owner) will return 1 and tooltip:GetOwner() will return owner. For instance, first call GameTooltip:SetOwner(UIParent). Then GameTooltip:IsOwned(UIParent) will return 1 and GameTooltip:GetOwner() will return UIParent.
- You can also move the tooltip by x or y, where positive x is to the right and positive y is up. Thus, negative x is to the left and negative y is down. Doesn't work if anchor is ANCHOR_CURSOR, ANCHOR_PRESERVE, or ANCHOR_NONE.