Thread Tools Display Modes
11-28-10, 09:11 AM   #1
mentalnutsy
A Cyclonian
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 47
Not saving frame location

Ok below is the code i am trying to save the location of and for the life of me cannot get it to work I get no errors and the dam thing keeps saving to layout-local.txt. All my other options save fine i just cannot get the location of this frame to save in the saved variables.

Code:
local   RTMainFrame = CreateFrame("Frame", "RTMainFrame", UIParent)
	RTMainFrame:RegisterEvent("ADDON_LOADED")
	RTMainFrame:SetScript("OnEvent", function(self, event, addon)
	if addon == "NuttyRecruit" then
        RTMainFrame.BackDrop = {bgFile = "Interface\\TutorialFrame\\TutorialFrameBackground", 
        edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", 
        insets = { 
                left = 4,
                right = 4,
                top = 4,
                bottom = 4
            }
        }
    RTMainFrame:SetBackdrop(RTMainFrame.BackDrop)
    RTMainFrame:SetBackdropColor(0, 0, 0, 1)
    RTMainFrame:SetHeight(216)
    RTMainFrame:SetWidth(180)
    NuttyRecruit.db.profile.rtframe.posistion = NuttyRecruit.db.profile.rtframe.posistion or {p="CENTER",r="CENTER",x=0,y=0}
    RTMainFrame:SetPoint(NuttyRecruit.db.profile.rtframe.posistion.p, UIParent, NuttyRecruit.db.profile.rtframe.posistion.r, NuttyRecruit.db.profile.rtframe.posistion.x, NuttyRecruit.db.profile.rtframe.posistion.y)	
    RTMainFrame:SetFrameStrata("HIGH")
    RTMainFrame:SetClampedToScreen(true)
    RTMainFrame:SetMovable(true)

		end
	end)
--ROLL TRACKER TEXT AT TOP OF BOX----
    Fontstring1 = RTMainFrame:CreateFontString("Fontstring1","OVERLAY",RTMainFrame)
    Fontstring1:SetFont("Fonts\\FRIZQT__.TTF",10)
    Fontstring1:SetPoint("TOPLEFT", 15, -15)
    Fontstring1:SetText(L["Roll Tracker"])
    Fontstring1:SetJustifyH("LEFT")
	
--frame mover--
function NuttyRecruit:MoveFrame()
		RTMainFrame:EnableMouse(NuttyRecruit.db.profile.lock)
		RTMainFrame:RegisterForDrag("LeftButton")
		RTMainFrame:SetScript("OnDragStart", RTMainFrame.StartMoving)
		RTMainFrame:SetScript("OnDragStop", RTMainFrame.StopMovingOrSizing)
		NuttyRecruit.db.profile.rtframe.posistion.p, NuttyRecruit.db.profile.rtframe.posistion.rt,NuttyRecruit.db.profile.rtframe.posistion.rp,NuttyRecruit.db.profile.rtframe.posistion.x, NuttyRecruit.db.profile.rtframe.posistion.y = RTMainFrame:GetPoint()
	if NuttyRecruit.db.profile.lock then
		Fontstring1:SetText(L["Roll Tracker UNLOCKED"])
	else 
		Fontstring1:SetText(L["Roll Tracker"])
	end
end
  Reply With Quote
11-28-10, 09:24 AM   #2
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
Throw in

Code:
RTMainFrame:SetUserPlaced(true)
That should do the trick as far as I can see.
  Reply With Quote
11-28-10, 09:30 AM   #3
mentalnutsy
A Cyclonian
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 47
Originally Posted by Waky View Post
Throw in

Code:
RTMainFrame:SetUserPlaced(true)
That should do the trick as far as I can see.
I thought SetUserPlaced was used to make shur an addon saved to the layout-local.txt. I am trying to save it to saved variables. l ill give it a try now brb

Edit: As suspected did not work sadly

Last edited by mentalnutsy : 11-28-10 at 09:36 AM.
  Reply With Quote
11-28-10, 12:09 PM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Do a :ClearAllPoints() before doing :SetPoint() from your saved variables.
  Reply With Quote
11-28-10, 12:24 PM   #5
mentalnutsy
A Cyclonian
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 47
Ty for yer help guys

Think i solved it now see wowace post below on how it was done

http://forums.wowace.com/showthread....048#post312048
  Reply With Quote
11-28-10, 05:57 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Eh, that works, too. Your original problem was that you weren't telling it to save the position whenever you moved it. Sure, you used :GetPoint() to find wherever it was placed, but that line only got called once, as you put it outside of your OnDragStop script.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Not saving frame location


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