Android Question Vertical seek bar

SeaBee

Member
Licensed User
I am using Derez's excellent vseekbar class, but have a problem, though clearly the vseekbar is working 'as designed'.

In Activity_Create I set an initial value at the centre of the scale, and all works perfectly - the value changes on sliding, the calculation runs, and the correct result is displayed. However, as the scale is a bit 'busy', I have added nudge buttons at either end to increment or decrement the value by one for fine tuning.

The issue is that the values of each modus operandi appear independent of each other. If I set an initial value of 20 and slide the caret to, say, 10, it moves as expected. However, if I then use the nudge 'up' button, the value returns to 20 and then applies the up increment to that value.

I need to get the nudge buttons to work on the caret value, not on the last set value, the difference being the 'userchanged' in the vSeekBar_ValueChanged event. Using the slider, userchanged = True, whereas using the buttons it is False.

I have spent some considerable time on trying to fix this, but I usually end up with an infinite loop! :eek:

Any suggestions would be most welcome.

Chris C-B

Ps. The nudge buttons work fine on the standard horizontal seek bar.
 
Last edited:

SeaBee

Member
Licensed User
Solved with an embarrassingly simple couple of lines of code. My brain must have been on holiday!

This didn't work:

B4X:
Sub vsbSpeed_ValueChanged(Value As Int, UserChanged As Boolean)
     
    Calculate 'Sub that consumes vsbSpeed.Value
 
End Sub

B4X:
Sub ivDown_Click

    vsbSpeed.Value = vsbSpeed.Value - 1

End Sub

This did work:

B4X:
Sub vsbSpeed_ValueChanged(Value As Int, UserChanged As Boolean)
   
    vsbS = Value
    Calculate 'Sub that consumes vsbSpeed.Value
 
End Sub

B4X:
Sub ivDown_Click

    vsbSpeed.Value = vsbS - 1

End Sub
 
Upvote 0
Top