Lucas Eduardo Active Member Licensed User Nov 29, 2019 #1 Hello, i would like to know if is there a way to scrolls the seek bar in steps like 10 to 10 with max 100 using the SeekBar of XUIViews? https://www.b4x.com/android/forum/t...ss-platform-views-and-dialogs.100836/#content
Hello, i would like to know if is there a way to scrolls the seek bar in steps like 10 to 10 with max 100 using the SeekBar of XUIViews? https://www.b4x.com/android/forum/t...ss-platform-views-and-dialogs.100836/#content
Jorge M A Well-Known Member Licensed User Longtime User Nov 29, 2019 #2 The effect is not smooth, if you drag the knob. Code: Sub B4XSeekBar1_ValueChanged (Value As Int) B4XSeekBar1.Value = Round (Value/10) * 10 Log("Value: " & B4XSeekBar1.Value) End Sub Upvote 0
The effect is not smooth, if you drag the knob. Code: Sub B4XSeekBar1_ValueChanged (Value As Int) B4XSeekBar1.Value = Round (Value/10) * 10 Log("Value: " & B4XSeekBar1.Value) End Sub
stevel05 Expert Licensed User Longtime User Nov 29, 2019 #3 You can get it to snap on mouse release by adding a listener to the basepane of the seekbar: Code: Dim Jo As JavaObject = B4XSeekBar1.mBase Dim O As Object = Jo.CreateEventFromUI("javafx.event.EventHandler","Seekbar",Null) Jo.RunMethod("setOnMouseReleased",Array(O)) Then adding Jorge's code to the mouse released event callback: Code: Sub SeekBar_Event (MethodName As String, Args() As Object) As Object B4XSeekBar1.Value = Round (B4XSeekBar1.Value/10) * 10 Log("Value: " & B4XSeekBar1.Value) End Sub Not much different but it's a little nicer experience maybe. Upvote 0
You can get it to snap on mouse release by adding a listener to the basepane of the seekbar: Code: Dim Jo As JavaObject = B4XSeekBar1.mBase Dim O As Object = Jo.CreateEventFromUI("javafx.event.EventHandler","Seekbar",Null) Jo.RunMethod("setOnMouseReleased",Array(O)) Then adding Jorge's code to the mouse released event callback: Code: Sub SeekBar_Event (MethodName As String, Args() As Object) As Object B4XSeekBar1.Value = Round (B4XSeekBar1.Value/10) * 10 Log("Value: " & B4XSeekBar1.Value) End Sub Not much different but it's a little nicer experience maybe.
stevel05 Expert Licensed User Longtime User Nov 29, 2019 #4 Ooops sorry, just realized it's B4a, will look for the correct code. Upvote 0
stevel05 Expert Licensed User Longtime User Nov 29, 2019 #5 Hmm, sorry it seems that this option is not available for B4a, the touch listener is in use by the Seekbar, we can't listen to it and use the seekbar. Upvote 0
Hmm, sorry it seems that this option is not available for B4a, the touch listener is in use by the Seekbar, we can't listen to it and use the seekbar.
Erel B4X founder Staff member Licensed User Longtime User Dec 1, 2019 #6 XUI Views V2.18 - B4XSeekBar.Interval field / designer property - Allows changing the values interval. Default value is 1. https://www.b4x.com/android/forum/t...ross-platform-views-and-dialogs.100836/page-1 Upvote 0
XUI Views V2.18 - B4XSeekBar.Interval field / designer property - Allows changing the values interval. Default value is 1. https://www.b4x.com/android/forum/t...ross-platform-views-and-dialogs.100836/page-1