I have simple timer that print counter in label. The problem is label not imidiately changed the value. Anyone can help ?
here is the code
Note: Sory for the title, it should be "Label not refreshed inside for next loop"
here is the code
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Label1 As Label
Private Button1 As Button
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.SetFormStyle("UNIFIED")
MainForm.RootPane.LoadLayout("l1") 'Load the layout file.
MainForm.Show
End Sub
Sub Button1_Action
Dim n As Int
For n = 0 To 5
Label1.Text = n
Log(n)
Delay(500)
Next
End Sub
Sub Delay (DurationMs As Int)
Dim target As Long = DateTime.Now + DurationMs
Do While DateTime.Now < target
Loop
End Sub
Note: Sory for the title, it should be "Label not refreshed inside for next loop"
Last edited: