lotrointerface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Tutorials & Other Helpful Information (L)

Reply
Thread Tools Display Modes
  #1  
Unread 04-22-2013, 07:54 AM
wmrojer wmrojer is offline
The Wary
 
Join Date: Nov 2012
Location: Sweden
Posts: 4
How to make a Window resizable

Since I see that a lot of plugins does not support rezising of there windows, and I really like to be able to resize them I'm writing a short guide on how to make windows resizable.

The Easy way:

First of the window must be of type Turbine.UI.Lotro.Window

This code is simplified and will not make a working window. It just shows the stuff that needed for the resizing to wrok.
Code:
ListWindow = class(Turbine.UI.Lotro.Window);

function ListWindow:Constructor()
	Turbine.UI.Lotro.Window.Constructor(self);

	self:SetSize(Settings.listWidth, Settings.listHeight);
	self:SetMaximumSize(500,1200);
	self:SetMinimumSize(300,200);
	self:SetResizable(true);
       --- Here should be the creation of our child controls
end

function ListWindow:SizeChanged(args)
	Settings.listWidth, Settings.listHeight = self:GetSize();
        -- Resize our child windows
	self.listTree:SetSize(Settings.listWidth-20,  Settings.listHeight-50);
	self.listScrollBar:SetHeight(Settings.listHeight-50);
	self.listScrollBar:SetLeft(Settings.listWidth-20);
end
self:SetMaximumSize(500,1200) defines the largest size we want to allow the window to be resized to.

self:SetMinimumSize(300,1200) defines the smallest size we want to all the window to be resized to.

self:SetResizable(true) is where the magic is. This tells Lotro that the user should be able to resize the window. Mouse pointer will automatically change when positioned over the lower and right border of the window.

function ListWindow:SeizeChanged(args) is where we catch the rezising of the window. Here we need to reposition and resize all our child controls.

It is actually this easy to make a window resizable. The biggest part is the SizeChanged method where we need to resize and reposition our child controls.

Last edited by wmrojer : 04-22-2013 at 08:06 AM.
Reply With Quote
  #2  
Unread 05-05-2013, 01:31 PM
Wicky71's Avatar
Wicky71 Wicky71 is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: Jan 2012
Posts: 12
Window resizable extension

The code works fine, but when you load the plugin with the Plugin Manager it generates an error massage. After the first resizing it works fine.

The magic is to define the resizable controls bevor the size define of the window.

Code:
ListWindow = class(Turbine.UI.Lotro.Window);

function ListWindow:Constructor()
	Turbine.UI.Lotro.Window.Constructor(self);
--- define section for resizable controls

--- define section for resizable controls
	self:SetSize(Settings.listWidth, Settings.listHeight);
	self:SetMaximumSize(500,1200);
	self:SetMinimumSize(300,200);
	self:SetResizable(true);
       --- Here should be the creation of our child controls
end

function ListWindow:SizeChanged(args)
	Settings.listWidth, Settings.listHeight = self:GetSize();
        -- Resize our child windows
	self.listTree:SetSize(Settings.listWidth-20,  Settings.listHeight-50);
	self.listScrollBar:SetHeight(Settings.listHeight-50);
	self.listScrollBar:SetLeft(Settings.listWidth-20);
end
The reason is that "self:SetSize(Settings.listWidth, Settings.listHeight);" calls the function "SizeChangend". At this time the objects are still unknown in the plugin.
Reply With Quote
  #3  
Unread 05-06-2013, 08:28 AM
MercedMike MercedMike is offline
The Wary
Interface Author - Click to view interfaces
 
Join Date: Apr 2012
Posts: 1
Thumbs down Resizing

I want to do the other way --

Have a window which is normally resizable open up at a different size than the usual default.

Can that be done?

Thanks!
Reply With Quote
  #4  
Unread 05-06-2013, 01:41 PM
Wicky71's Avatar
Wicky71 Wicky71 is offline
The Indomitable
Interface Author - Click to view interfaces
 
Join Date: Jan 2012
Posts: 12
Resizing

Quote:
I want to do the other way --

Have a window which is normally resizable open up at a different size than the usual default.

Can that be done?
The code "self:SetSize(Settings.listWidth, Settings.listHeight);" fix the size of the window.

"Settings.listWidth" and "Settings.listHeight" are variables loadet from the saved plugin options. It can also numbers are there

A usual default (standart size you mean?) does not exist.

Hope it helps
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
How do I make a song using ABC Justin12221 Tutorials & Other Helpful Information (L) 3 11-05-2010 11:09 PM
How to make a Hybrid littlebuddha79 Interface Help (L) 3 03-13-2009 09:49 PM
Resizable health and powerbars and more Passatuner LotRO Wish List (L) 1 02-15-2008 03:34 PM
Resizable and reshapeable minimap Passatuner LotRO Wish List (L) 0 10-04-2007 02:25 PM
Is it possible to make windows resizable? TinMan Interface Requests (L) 1 03-24-2007 09:50 AM


All times are GMT -5. The time now is 06:17 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui