do until problem

tufanv

Expert
Licensed User
Longtime User
Hello ,


I have set edittext1 and edittext2 equals to 1 in designer and savged.
And this is the code :

with untill loop code i want every 1 second to add 1 to text 1 until its equals to 15 ( it will start as 1 will go thru 2 , 3 ,4 and when reching 15 it will stop)
but in moye code it directly goes to 15 in 1 second without going thru 2,3,4,5 ... 15

This is t he code ? Where am i wrong


B4X:
#Region  Project Attributes 
   #ApplicationLabel: B4A Example
   #VersionCode: 1
   #VersionName: 
   'SupportedOrientations possible values: unspecified, landscape or portrait.
   #SupportedOrientations: unspecified
   #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes 
   #FullScreen: False
   #IncludeTitle: True
#End Region

Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.

End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.

   Dim Button1 As Button

   Dim timer1 As Timer
   
   
   Dim EditText1 As EditText
   Dim EditText2 As EditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("main")
    timer1.initialize("timer1", 1000)

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub



Sub Button1_Click
timer1.enabled = true



End Sub

Sub timer1_tick

Do Until EditText1.Text = "15.0"
EditText2.Text = EditText2.Text + 5
EditText1.Text = EditText1.Text + 1
If EditText1.Text = "15" Then Exit
Loop

End Sub
 
Last edited:

tufanv

Expert
Licensed User
Longtime User
yes i want it to change every 1 second .
Why does it go directly to 15 ? how can i do it like +1 every 1 second ?

Thank you Erel
 
Upvote 0
Top