Thread Tools Display Modes
10-02-22, 12:53 AM   #1
hasnogaems
A Flamescale Wyrmkin
 
hasnogaems's Avatar
Join Date: Apr 2016
Posts: 109
I'm looking for reference

I'm looking for example of basic addon that will permanently move any blizzard frame.
  Reply With Quote
10-03-22, 05:00 PM   #2
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
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)
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote
10-08-22, 12:04 PM   #3
hasnogaems
A Flamescale Wyrmkin
 
hasnogaems's Avatar
Join Date: Apr 2016
Posts: 109
Originally Posted by LudiusMaximus View Post
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.

Last edited by hasnogaems : 10-08-22 at 12:07 PM.
  Reply With Quote
10-09-22, 02:41 AM   #4
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
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)
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote
10-13-22, 07:19 AM   #5
hasnogaems
A Flamescale Wyrmkin
 
hasnogaems's Avatar
Join Date: Apr 2016
Posts: 109
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.
  Reply With Quote
10-13-22, 08:18 AM   #6
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
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)
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote
10-13-22, 01:24 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
That is good to know. Will have to leave myself a note for a future addition to nUI rofl
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » I'm looking for reference

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