Functions of the Slider interface don't work

Hi, :slight_smile:

I’m using NiftyGUI and jME3 with the latest nightly update. I was trying to set the initial value (and min, max, stepSize, …) of a slider dynamically per Java:

[java][/java]private void initSlider(String controlId, float value){

Slider slider = Main.getNifty().getCurrentScreen().findNiftyControl(controlId, Slider.class);



(Simplified function - the parameters controlid and value are correct, )

This is an example of a slider, that I’m using:

[xml]<control id=“theControlId” name=“horizontalSlider” x=“50%” y="-100" width=“50%”/>[/xml]

Using the corresponding attributes in the XML file works:

min=“0” max=“2” stepSize=“0.05” initial=“1”

So, when I call the function (After switching to the right screen and so on, this is not the problem - The slider is available), the slider’s value doesn’t change. Debugging the code showed, that the function setValue(value); is called correctly with the right value on an existing slider instance.

I guess, this is a bug inside of the code, that implements the Slider interface (de.lessvoid.nifty.controls). None of the functions, that I tested, worked:

  • setMin
  • setMax
  • setStepSize
  • setValue

Did anyone of you succeed changing a slider's attributes per Java?
destro :)

Works fine here.

In XML values are :

[xml]<control id="soundSlider" name="horizontalSlider" width="300px" initial="100" buttonStepSize="10" />[/xml]

in Java:

[java] screen.findNiftyControl("soundSlider", Slider.class).setMin(5f);

screen.findNiftyControl("soundSlider", Slider.class).setMax(50f);

screen.findNiftyControl("soundSlider", Slider.class).setStepSize(7f);


The result is as expected.