Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private btnOTP As Button
Private timer As Timer
Private timeout 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")
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub OTP_Tick
timeout = timeout-1
btnOTP.Text = $"Timeout: ${timeout} sec."$
If timeout <=0 Then
btnOTP.Enabled = True
btnOTP.Text = "Get OTP"
timer.Enabled = False
End If
End Sub
Private Sub btnOTP_Click
timeout = 120
btnOTP.Text = $"Timeout: ${timeout} sec."$
btnOTP.Enabled = False
timer.Initialize("OTP",1000)
timer.Enabled = True
End Sub
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private btnOTP As Button
Private timer As Timer
Private timeout 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")
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub OTP_Tick
timeout = timeout-1
btnOTP.Text = $"Timeout: ${timeout} sec."$
If timeout <=0 Then
btnOTP.Enabled = True
btnOTP.Text = "Get OTP"
timer.Enabled = False
End If
End Sub
Private Sub btnOTP_Click
timeout = 120
btnOTP.Text = $"Timeout: ${timeout} sec."$
btnOTP.Enabled = False
timer.Initialize("OTP",1000)
timer.Enabled = True
End Sub