Thread Tools Display Modes
09-17-14, 10:27 AM   #1
evilbib
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 30
WatchFrame Position

Hi,

I tried to reposition the WatchFrame without losing the position "autoupdate" if the Sidebars are enabled.
My goal was to change the default position (without sidebars) -50 vertically and if I tick on sidebars the WatchFrame moves a bit to the left.

This is all I got since I am pretty new to this.

Code:
WatchFrame:ClearAllPoints()
WatchFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", 0, -50)

MultiBarRight:SetScript("OnUpdate", function()
	WatchFrame:ClearAllPoints()
	WatchFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -25, -50)
end)

MultiBarLeft:SetScript("OnUpdate", function()
	WatchFrame:ClearAllPoints()
	WatchFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -100, -50)
end)
This doesn't work though. The position is only correct if I have both sidebars enabled.
  Reply With Quote
09-17-14, 10:33 AM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
You could anchor the watchframe to the sidebar instead of the minimap.
Like
Lua Code:
  1. WatchFrame:ClearAllPoints()
  2. WatchFrame:SetPoint("TOPRIGHT", <sidebarframename whatever it is>, "TOPLEFT")
  Reply With Quote
09-17-14, 10:42 AM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Duugu View Post
You could anchor the watchframe to the sidebar instead of the minimap.
Like
Lua Code:
  1. WatchFrame:ClearAllPoints()
  2. WatchFrame:SetPoint("TOPRIGHT", <sidebarframename whatever it is>, "TOPLEFT")
He want it's position to depends on two frame like this:

Lua Code:
  1. if WatchFrame_Update then
  2.     hooksecurefunc("WatchFrame_Update", function(self)
  3.         if MultiBarRight:IsShown() and MultiBarLeft:IsShown() then
  4.             WatchFrame:ClearAllPoints()
  5.             WatchFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -100, -50)
  6.         elseif MultiBarRight:IsShown() then
  7.             WatchFrame:ClearAllPoints()
  8.             WatchFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -25, -50)
  9.         else
  10.             WatchFrame:ClearAllPoints()
  11.             WatchFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", 0, -50)
  12.         end
  13.     end)
  14. end
  Reply With Quote
09-17-14, 10:43 AM   #4
evilbib
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 30
Originally Posted by Duugu View Post
You could anchor the watchframe to the sidebar instead of the minimap.
Like
Lua Code:
  1. WatchFrame:ClearAllPoints()
  2. WatchFrame:SetPoint("TOPRIGHT", <sidebarframename whatever it is>, "TOPLEFT")
The problem is these two lines dont do anything it doesn't matter where I anchor them
  Reply With Quote
09-17-14, 10:44 AM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by pingumania View Post
The problem is these two lines dont do anything it doesn't matter where I anchor them
Because the WatchFrame_Update overrides it's values on each update, you gonna need to hook that function.
  Reply With Quote
09-17-14, 10:46 AM   #6
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by Resike View Post
Because the WatchFrame_Update overrides it's values on each update, you gonna need to hook that function.
They are re-anchoring the watchframe? I'm wondering what this could be good for.
  Reply With Quote
09-17-14, 10:47 AM   #7
evilbib
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 30
Originally Posted by Resike View Post
He want it's position to depends on two frame like this:

Lua Code:
  1. if WatchFrame_Update then
  2.     hooksecurefunc("WatchFrame_Update", function(self)
  3.         if MultiBarRight:IsShown() and MultiBarLeft:IsShown() then
  4.             WatchFrame:ClearAllPoints()
  5.             WatchFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -100, -50)
  6.         elseif MultiBarRight:IsShown() then
  7.             WatchFrame:ClearAllPoints()
  8.             WatchFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -25, -50)
  9.         else
  10.             WatchFrame:ClearAllPoints()
  11.             WatchFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", 0, -50)
  12.         end
  13.     end)
  14. end
Thanks but this doesn't work if I change the sidebars; the position resets. With a reload I can fix it but that was something I wanted to avoid.
  Reply With Quote
09-17-14, 10:50 AM   #8
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Duugu View Post
They are re-anchoring the watchframe? I'm wondering what this could be good for.
They also use something similar function to prevent the WatchFrame to be overridden, by action bars and other game elements.
  Reply With Quote
09-17-14, 10:56 AM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by pingumania View Post
Thanks but this doesn't work if I change the sidebars; the position resets. With a reload I can fix it but that was something I wanted to avoid.
Okay how about this?

Lua Code:
  1. local setting
  2. hooksecurefunc(WatchFrame, "SetPoint", function(self)
  3.     if not setting then
  4.         setting = true
  5.         if MultiBarRight:IsShown() and MultiBarLeft:IsShown() then
  6.             self:ClearAllPoints()
  7.             self:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -100, -50)
  8.         elseif MultiBarRight:IsShown() then
  9.             self:ClearAllPoints()
  10.             self:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -25, -50)
  11.         else
  12.             self:ClearAllPoints()
  13.             self:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", 0, -50)
  14.         end
  15.         setting = nil
  16.     end
  17. end)
  Reply With Quote
09-17-14, 11:00 AM   #10
evilbib
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 30
Originally Posted by Resike View Post
Okay how about this?

Lua Code:
  1. local setting
  2. hooksecurefunc(WatchFrame, "SetPoint", function(self)
  3.     if not setting then
  4.         setting = true
  5.         if MultiBarRight:IsShown() and MultiBarLeft:IsShown() then
  6.             self:ClearAllPoints()
  7.             self:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -100, -50)
  8.         elseif MultiBarRight:IsShown() then
  9.             self:ClearAllPoints()
  10.             self:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", -25, -50)
  11.         else
  12.             self:ClearAllPoints()
  13.             self:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT", 0, -50)
  14.         end
  15.         setting = nil
  16.     end
  17. end)
Thank you very much works like a charm

edit:
The height needs to be set too or else it only shows 2 quests.
Code:
 self:SetHeight(UIParent:GetHeight() - 250)

Last edited by evilbib : 09-17-14 at 12:17 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » WatchFrame Position


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