Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private pnlMain As Panel
Private lblCatchMe As B4XView
Private tmrMove As Timer
Private blnMoving As Boolean
Private blnReverse As Boolean
Private intduration As Int
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
intduration=3000
pnlMain.Initialize("pnlMain")
Root.AddView(pnlMain,0,0,100%x,100%y)
lblCatchMe = XUIViewsUtils.CreateLabel
lblCatchMe.Color=Colors.Red
lblCatchMe.TextColor=Colors.White
lblCatchMe.Text="Catch me if you can!"
pnlMain.AddView(lblCatchMe,30%x,0,40%x,20%y)
blnMoving=True
blnReverse=False
tmrMove.Initialize("tmrMove",intduration)
tmrMove.Enabled=True
End Sub
Private Sub tmrMove_Tick()
If blnMoving Then
If blnReverse Then
lblCatchMe.SetLayoutAnimated(intduration,30%x,0,40%x,20%y)
Else
lblCatchMe.SetLayoutAnimated(intduration,30%x,80%y,40%x,20%y)
End If
blnReverse=Not(blnReverse)
End If
blnMoving=Not(blnMoving)
End Sub