WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   I'm looking for reference (https://www.wowinterface.com/forums/showthread.php?t=59240)

hasnogaems 10-02-22 12:53 AM

I'm looking for reference
 
I'm looking for example of basic addon that will permanently move any blizzard frame.

LudiusMaximus 10-03-22 05:00 PM

If you know the name of your frame (e.g. YourFrame), try this:

Lua Code:
  1. YourFrame:HookScript("OnShow",
  2.   function(self)
  3.     if not self:IsProtected() or not InCombatLockdown() then
  4.       self:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -500, 500)
  5.     end
  6.   end)

hasnogaems 10-08-22 12:04 PM

Quote:

Originally Posted by LudiusMaximus (Post 341147)
If you know the name of your frame (e.g. YourFrame), try this:

Lua Code:
  1. YourFrame:HookScript("OnShow",
  2.   function(self)
  3.     if not self:IsProtected() or not InCombatLockdown() then
  4.       self:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -500, 500)
  5.     end
  6.   end)

I tried it to replace my GameTooltip frame. The one that appears when mouseover npc. And sometimes it replaced but sometimes it in default position.
Wotlk classic.
It is only replaced on 1st show. If I mouseover to next npc it will be in default coordinates. Seems like OnShow not triggered again until I wait for tooltip to fade away fully and mouseover npc again.

LudiusMaximus 10-09-22 02:41 AM

OK, when it comes to the GameTooltip, it's maybe different.

But I found a solution for your problem some time ago and posted it on the Blizzard forum:
https://us.forums.blizzard.com/en/wo...ltip/1264049/2

Lua Code:
  1. hooksecurefunc("GameTooltip_SetDefaultAnchor", function(tooltip) tooltip:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -500, 500) end)

hasnogaems 10-13-22 07:19 AM

Worked like a charm!

I see there is GameTooltip_SetDefaultAnchor command, is it mean that I can setup secondary anchors that activated when certain frame shown? I would like my tooltip to anchor itself to the top of minimap when it is on.

LudiusMaximus 10-13-22 08:18 AM

Glad it works for you.

If you want to use other frames instead of UIParent as the reference frame, just do it.
If you want to make this conditional, put the condition into the hooked function. Like this:

Lua Code:
  1. hooksecurefunc("GameTooltip_SetDefaultAnchor", function(tooltip)
  2.   if MiniMap and MiniMap:IsShown() then
  3.     tooltip:SetPoint("TOPRIGHT", MiniMap, "TOPLEFT", -10, 0)
  4.   else
  5.     tooltip:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -500, 500)
  6.   end
  7. end)

Xrystal 10-13-22 01:24 PM

That is good to know. Will have to leave myself a note for a future addition to nUI rofl


All times are GMT -6. The time now is 10:27 AM.

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