Page 1 of 2

Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 8:37 am
by Perfect Human Interface
Hey all. This is an issue I kind of hinted at in another thread, but basically what it comes down to is I really need to be able to set a given GUI control (knobs, sliders, etc) to a particular value via some sort of input. This includes the value that the control is set to internally and outputting as well as the graphical representation (the graphics need to match the internal value). I need it to be able to be set instantly or continuously.

So, very simply, if I have a knob set to 25%, I want to be able to remotely set it to 75% from somewhere else in the schematic.

This functionality would open up a great deal of possibilities, a few of which I already have plans to take advantage of. Unfortunately though, when I click through the knob and slider modules I have, it all goes over my head at this point. So I'm stuck not knowing where to start on this. I'm not sure whether it's a complicated procedure I'm suggesting or a simple matter of injecting a value into a particular parameter somewhere.

If anyone can offer any insight that would be greatly appreciated!

Re: Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 12:21 pm
by tester
Have you tried wireless connections? "Module wireless out" spreads 1 level up and then down to all other modules, and "wireless out" spreads directly down into all modules on your level. Then you just connect "last" switch to you schematic, one node to pass through knobs data, and another node to "wireless input". Note, that wireless links must have the same names (case sensitive) and be of the same type in order to communicate.

Re: Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 12:51 pm
by Perfect Human Interface
tester wrote:Then you just connect "last" switch to you schematic, one node to pass through knobs data, and another node to "wireless input".


I think you're describing what I was looking for in the other thread, where you can simply pass through green data using lastswitch. Unfortunately that's not good enough; I need to be able to set the knob/slider itself to a particular value.

I'm aware of the wireless links and I'm sure they'll be useful. I just don't understand the GUI control modules' guts enough to ascertain how I can set their values. There's a lot going on in there. I also understand very little about the draw elements in FS at this point.

From a more traditional "programming" standpoint, there must be a variable stored somewhere that designates the control's setting, but I don't even know where that is. Maybe I just need to sit down and stare at it long enough.

Re: Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 1:04 pm
by Nubeat7
you also could initialise the knob via a doubleclick command to an fixed value just add an input to your knob ruby module wher you connect the value you want to have, name it, for example "init" , and add this code inside the ruby module below the mouseMoveCaptured method:

Code: Select all

def mouseLDouble x,y
@value = @init
output 0, @ init
end


now you can set the value to the init value via doubleclick

Re: Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 1:20 pm
by Perfect Human Interface
Oh I'm actually not using Ruby knobs at all. Once I found out the default knobs wouldn't reset to a default value I downloaded some others (pre-Ruby, I'm sure) that do. I've been gradually modifying them to my liking and so far they've worked perfectly. They look cooler too. :P

Re: Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 1:24 pm
by Nubeat7
you can do this without ruby too , you will need the "Mouse LDbl-click" primitive...

Re: Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 2:07 pm
by Perfect Human Interface
Okay, but I will want to be able to set the value within the schematic, not by user input, so is there some way I can set the knob to a custom value (not just a set default) via input?

Re: Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 3:09 pm
by tester
Post a simple schematic with your isolated issue (just put together all you need, and remove all else), that will help beyond any words.

Re: Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 3:19 pm
by Nubeat7
so you dont want a particular value?
anyway therefore use the lastswitch or maybe a selector like mentioned in the other thread, you can use any value to set the knob, doesn`t matter from where it comes in the schematic and you have different possibilities how to set this value,
also the value for the doubleklick can come from anywhere in your schematic, for example you could choose via a selector form where the value is taken, you dont need to give a particular value for that, also when you use the lastswitch you could choose between different value sources via a selector or by using more lastswitches in serie then its always the last valuechange which is setting the knob, therefore you could also build in a switch for every source you have to turn the individual source on or off.... there are a lot of possibilities to do stuff like this... you just need to find out which one fits best for you..

another place to set values is inside the preset module of the knob, also with a lastswitch right before the value meets the value-in from the presetparameter primitive like the midi in is set... but from there it is the same story - choose a source from where you want to take a value and set it in a way (via pushbutton, doubleclick, selector, or trigger from within the schematic..) it fits for you

Re: Set GUI Controls to a Value - Halp?

Posted: Mon Mar 18, 2013 7:05 pm
by Perfect Human Interface
Nubeat7 wrote:another place to set values is inside the preset module of the knob, also with a lastswitch right before the value meets the value-in from the presetparameter primitive like the midi in is set...


Ah, I just found this on my own. Got my knobs rigged up now and it's working beautifully. :D Thank goodness that wasn't too hard after poking my nose around things for long enough. Now I can make some real progress.