Hello all,
After searching for a post about a rotary knob that has steps (not continuous).. I finally gave up
the switch jumps from one value to another like that of the washing machine. any help appreciated.
I use these two subs in a clock application to rotate the clock's hands, it is the same as what you want with the change of starting angle and angle difference for each step:
B4X:
Sub setRotation(v As View, Angle As Float)
Dim jo = v As JavaObject
jo.RunMethod("setRotation", Array As Object(Angle))
End Sub
Sub drawhand(lbl As Label, index As Double)
Dim q As Double = 270 + 6 * index
setRotation(lbl,q)
End Sub
Add a click event to make the knob rotate to the next step.
I use these two subs in a clock application to rotate the clock's hands, it is the same as what you want with the change of starting angle and angle difference for each step:
B4X:
Sub setRotation(v As View, Angle As Float)
Dim jo = v As JavaObject
jo.RunMethod("setRotation", Array As Object(Angle))
End Sub
Sub drawhand(lbl As Label, index As Double)
Dim q As Double = 270 + 6 * index
setRotation(lbl,q)
End Sub
Add a click event to make the knob rotate to the next step.
The post I am trying to find is not about contentious values.. But incremental .. Knob devided in points so pointer jumps back and forth from point to point. That post still missing-in-action !
Thanks to all anyways.
You may have a look at this project, I made it as a XUI challenge.
It is a XUI B4X CustomView.
It needs some improvements.
At the moment it doesn't work yet with B4i, will be fixed.
You can turn the button, and it snaps onto the nearest value.
A click in the middle selects the next value, a LonkClick in the middle selects the prevous value.
EDIT: 2018.08.11
Removed the zip file.
A new version is HERE.