I’m sure there is a simple answer to this, but I’m fairly new to Xojo and need help please!
I’m creating a timer which is to display elapsed time. I have a ListBox with 3 columns, for H M & S.
At present I’m only concerned with displaying the seconds in Col 2 (3rd column) of the Listbox. The rollovers to M & H come later!
The code has a Do Until - Loop which updates the elapsed time & should display this in the Listbox.
At present, until it works, this runs for 10 seconds.
What happens at the moment is that when the Start button is clicked, nothing is displayed in the Listbox, until it exits the Do loop after 10 seconds or so, when it displays 11. I have seen from the debugger that the variable ‘elapsed’ is incrementing until it gets to 10, when the loop ends. The line inside the Do loop to update the listbox does not work.
My problem is that the Listbox does not display when I run the app or when I click the Start button.
The code I have is in the Action for a Start Button. My guess is that it should be somewhere else, and that’s what I’d like someone to tell me if possible.
The code in the Start button Action is this, and there is no other code.
Var Hrs, Mins, Secs, elapsed, current as Integer = 0 ’ not all used yet!
var start as Integer = System.Ticks / 60 ’ = seconds
Listbox1.FontSize = 20
Listbox1.CellValueAt(0, 2) = “0” 'This does not display
Do Until elapsed > 10 ’ how long to run, in seconds
current = System.Ticks / 60
elapsed = current - start
Listbox1.CellValueAt(0, 2) = elapsed.toString ’ Does not display
’ Updated Listbox appears at this point, when ‘elapsed’ is > 10
Thanks in advance for a solution!