View Single Post
  #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