Quantcast Saving window position - Page 3 - LoTROInterface
VGInterface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

Reply
Thread Tools Display Modes
  #21  
Unread 09-27-2010, 03:15 PM
Olenn's Avatar
Olenn Olenn is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 47
What I am trying to do is two fold. I want the window to have a default location and size when the addon is first installed. After that when the user moves or resizes the window, I want the window to save its size and location to a file so that the next time the user runs the game the window is in the same place and the same size that they left it in.

I tried your code and it does it still resets to 100 x 100 when I hit reload in plugin manager.

I have to go to work now, but I will keep hammering away at it tomorrow.

Thanks for all your help.
Reply With Quote
  #22  
Unread 09-27-2010, 03:38 PM
Kragenwar Kragenwar is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 26
Quote:
Originally Posted by Olenn
What I am trying to do is two fold. I want the window to have a default location and size when the addon is first installed. After that when the user moves or resizes the window, I want the window to save its size and location to a file so that the next time the user runs the game the window is in the same place and the same size that they left it in.

I tried your code and it does it still resets to 100 x 100 when I hit reload in plugin manager.

I have to go to work now, but I will keep hammering away at it tomorrow.

Thanks for all your help.
I think I realized my problem. The place where I had you put that code is actually for resizing the window i guess? Ill admit I didn't actually study the code thoroughly. It was just the only place where I seen something drag-gable. I can't seem to find where you are actually making the window moveable. So I am probably missing something.

Also just noticed that you are loading from "SatchelData" and saving to "Satchel".... Didn't notice it before, but those save/load calls need to match. That was probably the problem in the first place so you may need to go back to the self.PositionChanged function and get rid of that line I had you add to self.resizeHandle.MouseDown.

Last edited by Kragenwar : 09-27-2010 at 04:57 PM.
Reply With Quote
  #23  
Unread 09-28-2010, 12:23 PM
Olenn's Avatar
Olenn Olenn is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 47
I changed the SatchelData, thanks for spotting that.

I am not "making" the windows movable...they just are...is that wrong?
Reply With Quote
  #24  
Unread 09-28-2010, 12:48 PM
Kragenwar Kragenwar is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 26
No it's not wrong. I was mistaken, didn't realize that a turbine.ui.window was already moveable if you have a title bar on it. Just my lack of experience showing threw

Sorry for leading you in the wrong direction yesterday. You were actually correct in the first place with your PositionChanged function. So make sure you change your resizeHandle.MouseUp function back to the way it was before I suggested you change it.

Hope it all works out.
Reply With Quote
  #25  
Unread 09-30-2010, 01:53 AM
Olenn's Avatar
Olenn Olenn is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 47
For everyone that helped, THANK YOU!!!

Major break through today. The "save position" issue is resolved. It is now working properly and I have learned a ton in the process...

My hat is off to you all.

For anyone that is curious about the working code here it is.

Code:
SatchelWindow = class( Turbine.UI.Window );

function SatchelWindow:Constructor()
----CREATE THE WINDOW----
	Turbine.UI.Lotro.Window.Constructor( self );
	self:SetText("Satchel");
	self:SetSize( 325, 300 );
----LOAD PRIOR POSITION----
	self.Data = Turbine.PluginData.Load( Turbine.DataScope.Character,  "Satchel")
    if (self.Data==nil)then
		self.Data = { };
		self.Data.x = Turbine.UI.Display.GetWidth() - 400;
		self.Data.y = Turbine.UI.Display.GetHeight() - 300;
		self:SetPosition(self.Data.x,self.Data.y);
    else
		self:SetPosition(self.Data.x,self.Data.y)
    end

----SATCHEL SAVES POSITION IF MOVED----
	self.PositionChanged=function(sender,args)
		self.Data.x,self.Data.y=self:GetPosition()
		Turbine.PluginData.Save( Turbine.DataScope.Character, "Satchel", self.Data );
	end
	
----SATCHEL CLOSES WHEN ESC IS PRESSED----
	self:SetWantsKeyEvents( true );
	self.KeyDown = function( sender, args )
		if ( args.Action == Turbine.UI.Lotro.Action.Escape ) then
			sender:SetVisible( false ) 
		end
Feel free to use and distribute it!
Reply With Quote
  #26  
Unread 10-01-2010, 01:08 AM
Olenn's Avatar
Olenn Olenn is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 47
Updated to save position information as well,

Code:
SatchelWindow = class( Turbine.UI.Window );

function SatchelWindow:Constructor()
----CREATE THE WINDOW----
	Turbine.UI.Lotro.Window.Constructor( self );
	self:SetText("Satchel");
	self:SetSize( 325, 300 );
----LOAD PRIOR SIZE & POSITION----
	self.Data = Turbine.PluginData.Load( Turbine.DataScope.Character,  "Satchel")
    if (self.Data==nil)then
		self.Data = { };
		self.Data.x = Turbine.UI.Display.GetWidth() - 400;
		self.Data.y = Turbine.UI.Display.GetHeight() - 300;
		self.Data.sx = 325;
		self.Data.sy = 300;
		self:SetPosition(self.Data.x,self.Data.y);
		self:GetSize(self.Data.sx,self.Data.sy);
    else
		self:SetPosition(self.Data.x,self.Data.y)
		self:SetSize(self.Data.sx,self.Data.sy)
    end

----SATCHEL SAVES SIZE & POSITION IF MOVED----
	self.PositionChanged=function(sender,args)
		self.Data.x,self.Data.y=self:GetPosition()
		self.Data.sx,self.Data.sy=self:GetSize()
		Turbine.PluginData.Save( Turbine.DataScope.Character, "Satchel", self.Data );
	end
	
----SATCHEL CLOSES WHEN ESC IS PRESSED----
	self:SetWantsKeyEvents( true );
	self.KeyDown = function( sender, args )
		if ( args.Action == Turbine.UI.Lotro.Action.Escape ) then
			sender:SetVisible( false ) 
		end
Once again, thanks to everyone that helped over the past few days. It is great to be part of such an awesome community!
Reply With Quote
Reply


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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Plugins Not Saving Settings Valdacil Interface Help (L) 13 09-10-2010 10:43 PM
Help me to position my xp bar please or to hide it Eili Interface Help (L) 6 06-29-2010 05:36 PM
position toolbar problems Bazzard XML modification help (L) 7 07-11-2007 02:08 AM
Saving UI Layout... Sythix Interface Help (L) 1 07-05-2007 11:15 PM
chat window not saving position... AstroCat Interface Help (L) 1 07-01-2007 11:12 AM


All times are GMT -5. The time now is 05:55 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | VGInterface | LoTROInterface | MMOInterface | Swtorui