|
09-26-2010, 10:20 PM
|
|
The Undying
|
|
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.
|
09-27-2010, 12:31 AM
|
|
The Undying
|
|
Join Date: Sep 2010
Posts: 207
|
|
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
|
09-27-2010, 06:34 AM
|
|
The Undying
|
|
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.
|
09-27-2010, 11:36 AM
|
|
The Undying
|
|
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?
|
09-27-2010, 03:06 PM
|
|
The Undying
|
|
Join Date: Sep 2010
Posts: 207
|
|
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.
|
09-27-2010, 07:11 PM
|
|
The Undying
|
|
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.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:24 PM.
|
|