Android Question Spin Wheel

gilsonmv

Member
Hello everyone,
This is simplification of "Time Set via Scrollview B4A", post by Björn Roth on 03/10/2012.
The display is updated periodically.
Is it possible to update the display only when ScrollView Positions changed?
Thanks in advance.

B4X:
#Region Module Attributes
    #FullScreen: False
    #IncludeTitle: True
    #ApplicationLabel: TimeSet
    #VersionCode: 1
    #VersionName:
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

Sub Process_Globals

End Sub

Sub Globals
    Dim Timer2 As Timer
    Dim Panel1(3) As Panel
    Dim ScrollView1 As ScrollView
    Dim pp1 As Int   'ScrollView Positions
End Sub

Sub Activity_Create(FirstTime As Boolean)
    
       Timer2.Initialize("Timer2", 700) 'Display update period

    Activity.LoadLayout("main")
    For ii = 0 To 2
        If ii=0 Then
            SetupScrollViews(ScrollView1,ii,256)
        End If
Next
pp1=Rnd(0,12)*55
End Sub

Sub SetupScrollViews(scv As ScrollView, ii As Int, z As Int)
    Panel1(ii)= scv.Panel
    For i = -2 To z
        Dim Label1 As Label
        Label1.Initialize("")
        Label1.TextSize=24
        Label1.Gravity=Gravity.CENTER
        If i>-1 And i<(z-1) Then Label1.Text=NumberFormat( i,2,0)
        Panel1(ii).AddView(Label1,3,(i+2)*55,96,58)
    Next       
    Panel1(ii).Height=55*i+111
End Sub

Sub ScrollView1_ScrollChanged(Position As Int)
pp1=Position
Timer2.Enabled = True
End Sub

Sub Timer2_Tick
    vv1=Round(pp1/55)
    Activity.Title=vv1 'Show Display
End Sub
 

Alexander Stolte

Expert
Licensed User
Longtime User
For those who are looking, like me, this thread he means:

Since 2012 was a bit ago, maybe this will help you if there is no solution in sight:
 
Upvote 0

gilsonmv

Member
Thank you Alexander,
But in all the posted examples, the display is updated all the time.
I would like the program to stop and update the display only when the wheel turns.
 
Upvote 0
Top