View Full Version : Slider question

March 21st, 2010, 04:37 PM

I use a slider/thumb component linked to a NR variable.

The variable can be updated from girder using NetRemote.SetVariable(), and the thumb moves automatically to the correct position.

I'd like to be able to "push" the new value to girder when the thumb button is moved on NetRemote.

I thought of using RegisterVariableWatch to monitor the change from NR and use a girder action to update the variable on the girder side. But my RegisterVariableWatch function is called as soon the variable value changes, even if it's girder updating the variable.

How can I differenciate in my watch function if the variable has been updated by moving the thumb button, or due to girder ?



Rob H
March 22nd, 2010, 09:50 AM
You need to use the other form of RegisterVariableWatch for this - where the parameter is the Girder plugin instance rather than a function to call.

e.g. something like

NetRemote.RegisterVariableWatch(sliderName, NetRemote.GetPlugin("Girder"):GetCurrentInstance())

March 28th, 2010, 03:18 PM

Another question. I'd like my slider to be active only when one of my NR variables is at a specific value.

How can I do that ? Is there a way to "disable" a button (or any component in the interface) ?


Rob H
March 28th, 2010, 04:01 PM
Well, you can hide it by using a state rule (normally on a frame containing the slider). I suppose you could probably hide the thumb as well.

Alternatively you could have a button that uses an alpha-transparent image to cover the whole slider that would be controlled by a state rule. This has the advantage of 'greying' it out to show that it's not currently accessible.