I turn to Private Sub Slider1_ValueChange (Value As Double)for any slider shift. Can I do something to make the slider move only in steps?
1,1.33,1,66.1.99,2.33 and so on...
I do not want to go to Slider1_ValueChange at intermediate values
Sub Slider1_ValueChange (Value As Double)
Dim JO As JavaObject = Sender
If JO.RunMethod("isValueChanging",Null) Then Return
Log("New value: " & Value)
End Sub
setValueChanging is not required and is set by the system when needed.
Thank! But this only works after I release the mouse button. And how to make it so that when I pulled the mouse pointer, the values only changed according to the specified steps?
The key here is the snap to ticks option combined with a proper combination of tick units. This setting results in the following slider which can only be used to select values ranging from 1 to 4
For your example in post#1 you could use the code below, Value is in 1/3 steps:
B4X:
Private Sub sldTest_ValueChange (Value As Double)
Private intValue As Int
intValue = Value * 3 + 0.5
Value = intValue / 3
lblValue.Text = NumberFormat(Value, 1, 2)
End Sub