Controls RollIn Effect

pdabasic

Active Member
Licensed User
How can I stop this Timer when all controls take own start position?
I was trying anything but can't found the solution :(

B4X:
Sub Globals
Dim controls(0)
Dim controlsPos(100)
End Sub

Public Sub ControlsSlide (Target)
   contTarget = "main."&Target
   controls() = GetControls(contTarget)
   For i = 0 To ArrayLen(controls())-1
      controlsPos(i) = Control(controls(i)).Top
      Control(controls(i)).Top = 0
   Next
   contTimIn.Interval = 20
   contTimIn.Enabled = True
   Control(contTarget,Form).Show
End Sub

Sub contTimIn_Tick
   For i = 0 To ArrayLen(controls())-1
      If Control(controls(i)).Top < controlsPos(i) Then
         Control(controls(i)).Top = Control(controls(i)).Top + 10
      Else
         Control(controls(i)).Top = controlsPos(i)
      End If
   Next
End Sub
 

specci48

Well-Known Member
Licensed User
Longtime User
If all controls are arranged as requestet, just disable the timer.
B4X:
Sub contTimIn_Tick
    allArranged = True
    For i = 0 To ArrayLen(controls())-1
        If Control(controls(i)).Top < controlsPos(i) Then
            Control(controls(i)).Top = Control(controls(i)).Top + 10
            ' at least one control was not in the right position
            allArranged = False
        Else
            Control(controls(i)).Top = controlsPos(i)
        End If
    Next
    ' If all controls are arranged, disable the timer
    If allArranged = True Then
        contTimIn.Enabled = False
    End If
End Sub


specci48
 
Top