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