Thread Tools Display Modes
09-15-05, 05:54 AM   #1
ltdeta
A Murloc Raider
Join Date: Sep 2005
Posts: 9
Question Drag & Drop Save position

i have implemented drag and drop functionality for my MiniMapButton-Frame

it works perfect but then i exit the game and reenter
the position are reset



can anybody help me please ?
  Reply With Quote
09-15-05, 07:09 AM   #2
farang
A Deviate Faerie Dragon
 
farang's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2005
Posts: 19
you need to Save the Positions between sessions.

http://www.wowwiki.com/HOWTO:_Save_V..._Game_Sessions
  Reply With Quote
09-22-05, 09:45 AM   #3
ltdeta
A Murloc Raider
Join Date: Sep 2005
Posts: 9
Question

i can save the values but i have problems restoreing the postion after load

i use this for saving drag/drop position

Code:
.....
AgentButton:StopMovingOrSizing()
AgentButton_BeingDragged = false;
local x,y = this:GetCenter();
local px,py = this:GetParent():GetCenter();
local ox = x-px;
local oy = y-py;
RogueAgent.AgentButtonXOffset=ox;
RogueAgent.AgentButtonYOffset=oy;
RogueAgent.AgentButtonScale=AgentButton:GetScale();
......
and i used this for restoring the postion
Code:
....						
AgentButton:SetScale(RogueAgent.AgentButtonScale);

local px,py = AgentButton:GetParent():GetCenter();

AgentButton:SetPoint("TOPLEFT","UIParent","BOTTOMLEFT",px+(RogueAgent.AgentButtonXOffset/RogueAgent.AgentButtonScale),py+(RogueAgent.AgentButtonYOffset/RogueAgent.AgentButtonScale));
....
the position after loading is not the same exit the game

does anybody now how to use the API function SetPoint correcty ?
  Reply With Quote
09-22-05, 10:16 AM   #4
farang
A Deviate Faerie Dragon
 
farang's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2005
Posts: 19
yeah no wonder it doesn't work.

you mix the positions a bit ,so it will always shift with the same amount.

i will try to do an example later on and post it here.
  Reply With Quote
09-22-05, 04:24 PM   #5
ltdeta
A Murloc Raider
Join Date: Sep 2005
Posts: 9
that would be great
  Reply With Quote
09-22-05, 07:40 PM   #6
Kaelten
Jack's raging bile duct
 
Kaelten's Avatar
Featured
Join Date: May 2005
Posts: 782
check out the code I wrote in KC_Mobility, it does this by using GetTop and GetLeft
__________________
WowAce.com & CurseForge.com Adminstrator
Developer of Ace3, OneBag3, and many other addons and libraries
Project lead and Mac developer for the Curse Client

Anyone that needs what they want
And doesn't want what they need
I want nothing to do with
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Drag & Drop Save 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