WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Problem anchoring GameTooltip (https://www.wowinterface.com/forums/showthread.php?t=52492)

alikim 07-11-15 07:04 AM

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!

semlar 07-11-15 08:31 AM

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

alikim 07-11-15 08:59 AM

Beautiful, thank you very much!


All times are GMT -6. The time now is 03:39 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI