Quantcast Problem anchoring GameTooltip - WoWInterface
Thread Tools Display Modes
07-11-15, 07:04 AM   #1
alikim
A Fallenroot Satyr
Join Date: Jul 2015
Posts: 27
Problem anchoring GameTooltip

Code:
local function onMouseLeave(self, motion)
	GameTooltip:Hide()
end

local function onMouseEnter(self, motion)
	GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR")
	GameTooltip:SetAction(ActionButton_GetPagedID(ExtraActionBarFrame.button))
        GameTooltip:Show()
end
This works perfectly well on my custom button.

But I want this tooltip to show where most of them show up - around the right bottom corner. As far as I can see from ingame prints, while the gametip is on there, the anchor is set to "ANCHOR_NONE".

If I change the anchor to "ANCHOR_NONE" it stops working properly, the size of the box upon which the text appears is different every time it shows up and sometimes the text might not show up at all, just the box.

What I'm doing wrong here?

Thank you!
  Reply With Quote
07-11-15, 08:31 AM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
I don't believe ANCHOR_NONE actually sets the tooltip to the default position, it behaves essentially the same way as calling GameTooltip:ClearAllPoints()

To mimic the default behavior, what you actually want to use is GameTooltip_SetDefaultAnchor(GameTooltip, UIParent), which is defined in frameXML\GameTooltip.lua

Lua Code:
  1. function GameTooltip_SetDefaultAnchor(tooltip, parent)      
  2.   tooltip:SetOwner(parent, "ANCHOR_NONE");
  3.   tooltip:SetPoint("BOTTOMRIGHT", "UIParent", "BOTTOMRIGHT", -CONTAINER_OFFSET_X - 13, CONTAINER_OFFSET_Y);
  4.   tooltip.default = 1;
  5. end
  Reply With Quote
07-11-15, 08:59 AM   #3
alikim
A Fallenroot Satyr
Join Date: Jul 2015
Posts: 27
Beautiful, thank you very much!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Problem anchoring GameTooltip

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