iOSTable refresh / Timer

Hello Community,

I am new to Xojo. I am evaluating Xojo for several projects on iOS and desktop (and hopefully Android :slight_smile: ).

In my iOS test app:

  • I use an iOSTable
  • Before filling the table I play a sound
  • After the sound played I fill the table with the values

What happens is

  • The sound plays 2-3 seconds (good)
  • The table is filled up with values before the sound is finish (bad)

I have looked for possibilities (sleep, timer) but found no working solution.

From a thread in this forum I have learned that it is not possible to set the iOS thread to sleep like on the desktop with something like “App.SleepCurrentThread(2000)”

I checked the documentation the Xojo.Core.Timer, created a method and used the timer with CallLater.

The timer and the method work so far that I can set the text of a button to another value.
When I use the same code to fill the table in this method the values of the table are not displayed. The table appears to be empty.

Did I understand something wrong due to lack of knowledge?



Timer.CallLater should do what you want. Here is what I tried that worked:

On an iOS View, add a button and a table. I also dragged a 2-second sound file into the project (called TaDa).

In the button’s Action event, I put this code:

[code]// Play sound

// Fill table after 3 seconds
Xojo.Core.Timer.CallLater(3000, AddressOf FillTable)[/code]

I added a method called FillTable with this code:



For i As Integer = 1 To 50
Table1.AddRow(0, "Row: " + i.ToText)

When I run the project and click the button the sound plays and after it is finished, the table displays the data.

Hello Paul,

many thanks for your time and the reply.

Your code helped me to find my error. I have not considered the scope of my own variables and their values (grrrrr :slight_smile: ).
I had defined them again in the method but forgotten to use the values from the GUI text fields. When I saw that your code is working a light came up :-).