Is there a way to detect if a user stopped slyding? Maybe bij mouse input check or something. I tried mouse isButton0Release and hasFocus in the onSliderChange event to check if the user stopped sliding, but this doesn't work.
What i got so far
@NiftyEventSubscriber(id = "speedSlider")
public void onSliderChange(String id, SliderChangedEvent event)
{ boolean test2 = event.getSlider().hasFocus();
boolean test = nifty.getMouseInputEventQueue().getLastMouseDownEvent().isButton0Release();
System.out.println("before " + test2);
int speed = (int)event.getValue();
speedTextField.getRenderer(TextRenderer.class).setText(speed + "");
if(test2){
System.out.println("after " + test2);
main.setSimSpeed(speed);
}
}
And the slider in xml
<panel id="speed_up_down_panel" height="30px" width="180px" childLayout="center">
<control id="speedSlider" name="horizontalSlider" width="150px" min="1" initial="1" buttonStepSize="1">
<image id="#position" filename="Interface/sliderbutton.png" visibleToMouse="true" width="40px" height="40px"></image>
</control>
</panel>
The code is a bit messy now becuase i testing.