B4J Question Slider value_change

ludogomez

Member
Licensed User
Longtime User
Hello,

I'm using b4j for making a remote video player (I use MQTT between computer).

For that, I put a slider and I change the value by MQTT to update the position of the slider.

But I want to seek a new time my video with the mouse.
I want to use the sub "Value_change", but every time MQTT update the position, the sub "Value_change" is call.
I want to call the sub "Value_change" only with the mouse.

is it possible ?

Thanks a lot.
best regards
 

Daestrum

Expert
Licensed User
Longtime User
If you check the isPressed method on the slider, it will be true if the mouse moved the slider, and false if code changed the slider value.

s is the slider in the following code (needs JavaObject library)
B4X:
Sub s_ValueChange (Value As Double)
 Dim jo As JavaObject = s
 If jo.RunMethod("isPressed",Null) Then
  Log(Value) ' mouse moved the slider value
 Else
  Return ' code moved the slider value
 End If
End Sub
 
Upvote 0
Top