Quantcast

Set the frame anchor during UpdateFrame() instead of OnInitialize().

Johnny C. Lam [03-16-13 - 08:04]
Set the frame anchor during UpdateFrame() instead of OnInitialize().

This moves referencing the anchor stored in the profile to a later point
where if the profile is changed, the anchor in the new profile is used to
update the frame, and is needed for online profile-switching.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@785 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
Ovale.lua
diff --git a/Ovale.lua b/Ovale.lua
index 59b7ff5..8fc5b3a 100644
--- a/Ovale.lua
+++ b/Ovale.lua
@@ -92,10 +92,8 @@ function Ovale:OnEnable()
 	self:RegisterEvent("CHAT_MSG_ADDON")

 	OvaleOptions = Ovale:GetModule("OvaleOptions")
-	local profile = OvaleOptions:GetProfile()

 	self.frame = LibStub("AceGUI-3.0"):Create("OvaleFrame")
-	self.frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", profile.left, profile.top)
 	self:UpdateFrame()
 end

@@ -208,6 +206,9 @@ function Ovale:UpdateVisibility()
 end

 function Ovale:UpdateFrame()
+	local profile = OvaleOptions:GetProfile()
+	self.frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", profile.left, profile.top)
+
 	self.frame:ReleaseChildren()

 	self.frame:UpdateIcons()
@@ -216,8 +217,6 @@ function Ovale:UpdateFrame()

 	self.checkBoxes = {}

-	local profile = OvaleOptions:GetProfile()
-
 	for k,checkBox in pairs(self.casesACocher) do
 		self.checkBoxes[k] = LibStub("AceGUI-3.0"):Create("CheckBox");
 		self.frame:AddChild(self.checkBoxes[k])