Quantcast Help affecting other windows - LoTROInterface
VGInterface.com
Search Downloads


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

Reply
Thread Tools Display Modes
  #1  
Unread 09-26-2010, 10:20 PM
Olenn's Avatar
Olenn Olenn is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 47
Help affecting other windows

Okay i am working on the Settings Panel for Satchel, and I was on a roll until I hit the last line.

I am trying to make the slider change the opacity of the Satchel window. If I replace "Olenn.Satchel.SatchelWindow" with self it will successfully change the opacity of the settings window, but how do I get it to change the opacity of the Satchel window?

Code:
	self:SetText("Satchel Settings");
	self:SetSize(400, 500);
	self:SetPosition( (Turbine.UI.Display.GetWidth() / 2) - 200, (Turbine.UI.Display.GetHeight() / 2 ) - 325 );
	self:SetOpacity(1);
	

	self.opacityLabel = Turbine.UI.Label();
	self.opacityLabel:SetParent( self );
	self.opacityLabel:SetSize(100, 50);
	self.opacityLabel:SetPosition(50 , 75);
	self.opacityLabel:SetFont(Turbine.UI.Lotro.Font.Verdana18);
	self.opacityLabel:SetText("Opacity");		
	

	self.opacityScrollbar = Turbine.UI.Lotro.ScrollBar();
	self.opacityScrollbar:SetOrientation( Turbine.UI.Orientation.Horizontal );
	self.opacityScrollbar:SetParent( self );
	self.opacityScrollbar:SetSize( 300, 10 );
	self.opacityScrollbar:SetPosition(50,100);
	
	self.opacityScrollbar.ValueChanged = function( sender, args )
		Olenn.Satchel.SatchelWindow:SetOpacity( ( 55 + ( 200 - self.opacityScrollbar:GetValue() ) ) / 255 );
	end

Last edited by Olenn : 09-27-2010 at 11:21 AM.
Reply With Quote
  #2  
Unread 09-27-2010, 12:31 AM
Digital_Utopia's Avatar
Digital_Utopia Digital_Utopia is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 207
Send a message via MSN to Digital_Utopia Send a message via Yahoo to Digital_Utopia
Quote:
Originally Posted by Olenn
Okay i am working on the Settings Panel for Satchel, and I was on a rollo until I the last time.

I am trying to make the slider change the opacity of the Satchel window. If I replace "Olenn.Satchel.SatchelWindow" with self it will successfully change the opacity of the settings window, but how do I get it to change the opacity of the Satchel window?

Code:
	self:SetText("Satchel Settings");
	self:SetSize(400, 500);
	self:SetPosition( (Turbine.UI.Display.GetWidth() / 2) - 200, (Turbine.UI.Display.GetHeight() / 2 ) - 325 );
	self:SetOpacity(1);
	

	self.opacityLabel = Turbine.UI.Label();
	self.opacityLabel:SetParent( self );
	self.opacityLabel:SetSize(100, 50);
	self.opacityLabel:SetPosition(50 , 75);
	self.opacityLabel:SetFont(Turbine.UI.Lotro.Font.Verdana18);
	self.opacityLabel:SetText("Opacity");		
	

	self.opacityScrollbar = Turbine.UI.Lotro.ScrollBar();
	self.opacityScrollbar:SetOrientation( Turbine.UI.Orientation.Horizontal );
	self.opacityScrollbar:SetParent( self );
	self.opacityScrollbar:SetSize( 300, 10 );
	self.opacityScrollbar:SetPosition(50,100);
	
	self.opacityScrollbar.ValueChanged = function( sender, args )
		Olenn.Satchel.SatchelWindow:SetOpacity( ( 55 + ( 200 - self.opacityScrollbar:GetValue() ) ) / 255 );
	end
It loosely follows a hierarchy. Normally I would start off with a "main" class that would contain all the individual elements (windows, panels etc). Then you can actually do something like this in your main class;

self.setupWindow.opacityScrollBar.ValueChanged=fun ction(sender,args)
self.SatchelWindow:SetOpacity(<val>);
end

that way you can make a "master" area where you can handle actions between different elements
__________________

Lord of the Rings Online
75 Fourohfour | 75 Artemedis | 60 Whiskeytango Foxtrot | 50 Mistah Boombastic | 56 Appetizer | 25 Aggromi
61 Onepointtwentyone Gigawatts


World of Warcraft
90 Downlo 85 Gravetaxi 85 Ümad 85 Artemedis 85 Guthuros
Reply With Quote
  #3  
Unread 09-27-2010, 06:34 AM
SanDBoX's Avatar
SanDBoX SanDBoX is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Location: Idaho
Posts: 40
What I ended up doing to solve this problem (or one similar) is in my "main" file declared my windows as having a global scope then was able to access them using that instance name directly. I only had to pull it off once or twice to get things to work, but it seemed to work just fine.

Basically like this:

In your main program file ( the one that the .plugin calls ) you initialize you window -
ajustedwindow = mywindowlayout()

Then any other windows can call it from-
ajustedwindow:SetOpacity( mycalculatedvalue )

It seemed to work just fine for me.
Reply With Quote
  #4  
Unread 09-27-2010, 11:36 AM
Olenn's Avatar
Olenn Olenn is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 47
So I went to bed last night and slept on it. I woke up this morning and looked at all of your sdvice and stared at my code for a little bit...then I realized I was trying to calling SatchelWindow instead of satchelWindow ... stupid capital letters ... that capital S owes me three hours of life, lol.

Anyway, thanks for all of the help everyone!

New issue, the opacity slider is working great, but the value I am using for the opacity doesn't capture the full range.

Code:
self.opacityScrollbar.ValueChanged = function( sender, args )
		satchelWindow:SetOpacity( ( 55 + ( 200 - self.opacityScrollbar:GetValue() ) ) / 255 );
	end
the value was pulled form Turb's examples, but I am trying to go from fully opaque to full invisible.

Any thoughts?
Reply With Quote
  #5  
Unread 09-27-2010, 03:06 PM
Digital_Utopia's Avatar
Digital_Utopia Digital_Utopia is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 207
Send a message via MSN to Digital_Utopia Send a message via Yahoo to Digital_Utopia
Quote:
Originally Posted by Olenn
So I went to bed last night and slept on it. I woke up this morning and looked at all of your sdvice and stared at my code for a little bit...then I realized I was trying to calling SatchelWindow instead of satchelWindow ... stupid capital letters ... that capital S owes me three hours of life, lol.

Anyway, thanks for all of the help everyone!

New issue, the opacity slider is working great, but the value I am using for the opacity doesn't capture the full range.

Code:
self.opacityScrollbar.ValueChanged = function( sender, args )
		satchelWindow:SetOpacity( ( 55 + ( 200 - self.opacityScrollbar:GetValue() ) ) / 255 );
	end
the value was pulled form Turb's examples, but I am trying to go from fully opaque to full invisible.

Any thoughts?
I'm unfamiliar with the variety of slider you're using - so I have no idea what the value range is.

Please don't take this as any kind of self promotion, but I would suggest using the slider class in Palantir's DUInterface folder (feel free just to copy and paste the class somewhere - as well as the images) You can set the minimum and maximum values, as well as the step, making it as easy as just tying the slider value directly to the opacity of the window (and vice versa).

Otherwise, like I sad - in order to give you any help on that formula, I'd have to know what the range you're working with is.
__________________

Lord of the Rings Online
75 Fourohfour | 75 Artemedis | 60 Whiskeytango Foxtrot | 50 Mistah Boombastic | 56 Appetizer | 25 Aggromi
61 Onepointtwentyone Gigawatts


World of Warcraft
90 Downlo 85 Gravetaxi 85 Ümad 85 Artemedis 85 Guthuros
Reply With Quote
  #6  
Unread 09-27-2010, 07:11 PM
Olenn's Avatar
Olenn Olenn is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 47
Yeah, that was my problem...the slider I am using is part of Turb's package. It seems to work well enough, but the reference on the wiki doesn't say what the range is. The forumla I grabbed is from the original TheOneBag code. Looking at the math it seems that the value should be 1 -100, but it doesn't seem to trasition properly when I use it. When I modify the opacity manually in TheOneBag the scale is from 0.0 to 1.0.

I will try to impliment your code tomorrow (I am at work now). Thanks for everything.
Reply With Quote
  #7  
Unread 09-28-2010, 12:29 PM
Olenn's Avatar
Olenn Olenn is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 47
Thanks, DU. I have been digging through your code all day. Your classes are quite elegant and I have been learning a lot. I have my entire settings window built now and I am still figuring out what everything does and how to tie it all up.

Here is the code if you are interested.

Code:
import "Turbine";
import "Turbine.Gameplay";
import "Turbine.UI";
import "Turbine.UI.Extensions";
import "Turbine.UI.Lotro";
import "Turbine.Utils";
import "Olenn.Satchel"
import "Olenn.DUInterface";
import "Olenn.Utilsx";

---Big thanks to Digital_Utopia for use of his code!

SetupWindow = class(Olenn.DUInterface.Window );

function SetupWindow:Constructor()
	Olenn.DUInterface.Window.Constructor( self,380,225 );
	if ( self.window ~= nil ) then
		return;
	end
	self:SetPosition((Turbine.UI.Display.GetWidth() / 2) - (self:GetWidth() / 2), (Turbine.UI.Display.GetHeight() / 2 ) - (self:GetHeight()));
	self.tbHolder:SetWidth(255);
	self.tbRight:SetPosition(self.tbHolder:GetWidth()-35,0)
	self.tbHolder:SetLeft((self:GetWidth() - self.tbHolder:GetWidth())/2);
	self.tbCenter:SetSize(self.tbHolder:GetWidth()-70,42);
	self.tbCenter:SetPosition(self.tbLeft:GetLeft()+35,0)
	self.bg:SetSize(325, 180);
	self.text:SetText("Satchel Options");
	self.text:SetWidth(self.tbHolder:GetWidth());
	self.text:SetHeight(20);
	self.text:SetLeft(-35);
	self.text:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);
	self.clButton:SetPosition(self:GetWidth()-23,24)
	self.tw=Turbine.UI.Window();
	self.tw:SetParent(self);
	self.tw:SetSize(400,534);
	self.tw:SetPosition(0,0);
	self.tw:SetMouseVisible(false);
	
	
	self.sp=Turbine.UI.ListBox();
	self.sp:SetParent(self.tw);
	self.sp:SetPosition(12,65);
	self.sp:SetSize(356,448);


	self.sp:SetOrientation( Turbine.UI.Orientation.Horizontal );
	self.sp:SetMaxItemsPerLine(1);
	self.sp:SetBackColorBlendMode(0);
	self.sp:SetBlendMode(4);
	

----BOTTOM BUTTONS----
	self.defSettings=Turbine.UI.Lotro.Button();
	self.defSettings:SetParent(self.tw);
	self.defSettings:SetSize(128,20);
	self.defSettings:SetText("Default Settings");
	self.defSettings:SetPosition(41, 190);
	
	self.accSettings=Turbine.UI.Lotro.Button();
	self.accSettings:SetParent(self.tw);
	self.accSettings:SetSize(128,20);
	self.accSettings:SetText("Accept");
	self.accSettings:SetPosition(215,190);
	

----SATCHEL LOCKED CHECK BOX----
	self.sp:AddItem(self.hdr);
	self.sicHolder=Turbine.UI.Control();
	self.sicHolder:SetSize(280,30);
	
	self.locked = Olenn.DUInterface.CheckBox();
	self.locked:SetChecked(true);
	self.locked:SetText("Satchel locked");
	self.locked:SetParent(self.sicHolder);
	self.locked:SetPosition(-112,0);
	self.sp:AddItem(self.sicHolder); 

	
----SETTINGS SCOPE----
	self.acHolder=Turbine.UI.Control();
	self.acHolder:SetSize(400,30);
	
	self.ac = Olenn.DUInterface.DropDownBox({"Account","Character","Server"});
	self.ac:SetParent(self.acHolder);
	self.ac:SetPosition(160,0);
	self.acPanel = Turbine.UI.Window();
	self.acPanel:SetParent(self.sp);
	self.acPanel:SetPosition(0,0);
	self.acPanel:SetSize(480,448);
	self.acPanel:SetZOrder(99);
	self.acPanel:SetVisible(false);
	self.acLb = self.ac.listBox; 
	self.acLb:SetParent(self.acPanel);
	self.acLb:SetZOrder(99);
	self.acLb:SetBlendMode(0);
	self.acLb:SetBackColorBlendMode(0);
	self.acLb:SetPosition(200,200);
	self.acLabel=Turbine.UI.Label();
	self.acLabel:SetParent(self.acHolder);
	self.acLabel:SetPosition(-34,0);
	self.acLabel:SetSize(200,20);
	self.acLabel:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);
	self.acLabel:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
	self.acLabel:SetForeColor(Turbine.UI.Color(1,0.96,0.874,0.576));
	self.acLabel:SetText("Settings Scope");
	self.sp:AddItem(self.acHolder);


----OPACITY SLIDER----
	self.voHolder = Turbine.UI.Control();
	self.voHolder:SetSize(335,45);

	self.voSld = Olenn.DUInterface.Slider();
	self.voSld:SetParent(self.voHolder);
	self.voSld:SetLeft(20);
	self.voSld:SetText("Opacity");
	self.sp:AddItem(self.voHolder);
	
	self.bpHolder = Turbine.UI.Control();
	self.bpHolder:SetSize(335,45);


	
	self.txHolder = Turbine.UI.Control();
	self.txHolder:SetSize(400,45);

	
		self.acPanel.MouseClick=function(sender,args)
		self.ac.Close();
		self.acPanel:SetVisible(false);
	end


	self.ac.Opening =function()
		self.acPanel:SetVisible(true);
		tl,tt=self.acHolder:PointToScreen(self.acHolder:GetPosition());
		self.acLb:SetPosition(246,self.acHolder:GetTop()+21);
		
	end
	

	self.showSetup = function()
		
	end
	
	self.closeSetup = function()
	
	end
end
One question, is there a reason you create your own window as opposed to using Turb's? It seams that if I use Turb's window that it accepts skins from users. Just a question, thanks for everything.
Reply With Quote
  #8  
Unread 09-29-2010, 02:59 AM
Digital_Utopia's Avatar
Digital_Utopia Digital_Utopia is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Sep 2010
Posts: 207
Send a message via MSN to Digital_Utopia Send a message via Yahoo to Digital_Utopia
Quote:
Originally Posted by Olenn
Thanks, DU. I have been digging through your code all day. Your classes are quite elegant and I have been learning a lot. I have my entire settings window built now and I am still figuring out what everything does and how to tie it all up.

Here is the code if you are interested.


One question, is there a reason you create your own window as opposed to using Turb's? It seams that if I use Turb's window that it accepts skins from users. Just a question, thanks for everything.
Main reason is simple. The default Turbine.UI.Lotro.Window's title bar will continue to grow with the window. The real titlebars in the in game windows grow no larger than 255px. My class was designed to create a "realistic" Window. Sadly this means that it no longer accepts skins - but I felt that this was a necessary sacrifice.

The BaseWindow class on the other hand is a standard window without a titlebar - something, like most of my other elements in this folder, didn't exist in the actual API. The only exceptions are the previously mentioned Window class, and the CheckBox - which only exists because it was made before they added that class to the API.

As far as elegance? Nah. You can probably see several areas where I switch between self:<function> and self.function, and some of those classes could use constructors instead of requiring properties to be set. I will admit however that they work as close as possible to the behavior of the real thing, and I did try to make it as painless as possible to use.

If you're planning on using the DropDown box, you need to handle the open/close event yourself in it's parent class (the window/control you're displaying it in). The reason is that if you're dealing with a ListBox full of settings, opening the dropdown box will cause the list to fall behind items below it. So you essentially have to carry over the open/close event, and assign the list (i.e. the box that "drops down") to a local variable within that parent class, in order for it to display properly. Yeah, it's very ugly....but my intent was to get it working for use in Palantir - and despite the ugliness, it works well If you plan on using it, let me know and I'll post some example code.
__________________

Lord of the Rings Online
75 Fourohfour | 75 Artemedis | 60 Whiskeytango Foxtrot | 50 Mistah Boombastic | 56 Appetizer | 25 Aggromi
61 Onepointtwentyone Gigawatts


World of Warcraft
90 Downlo 85 Gravetaxi 85 Ümad 85 Artemedis 85 Guthuros
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
Transparent Windows Pobear Interface Help (D) 1 08-06-2010 04:57 AM
windows 7 installation Hotcoffee Interface Help (L) 3 04-07-2010 02:30 PM
Editing Windows IrishNite General Authoring Discussion (L) 0 12-29-2007 08:22 AM
Transparency on windows please oldmanwhoplays Interface Requests (L) 4 06-28-2007 06:20 AM
Chat Windows Jenna Interface Requests (L) 3 05-04-2007 06:42 PM


All times are GMT -5. The time now is 02:37 AM.


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