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"); |
Quote:
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 |
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. |
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 ) Any thoughts? |
Quote:
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. |
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. |
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"; |
Quote:
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 :D If you plan on using it, let me know and I'll post some example code. |
All times are GMT -5. The time now is 10:16 PM. |
vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI