I need to update an application I did with an old version of RealBasic which used extensively threads, and most of them accessed the UI directly. I solved most of the issues using the Task class provided in one of the sample xojo projects but there is something I haven’t been able to figure out:
In my thread I access the values of the listbox. Something like:
// add all listbox values //
for row = 1 to myListBox.ListCount-1
for col = 1 to 4
sum = sum + val(myListBox.cell(row,col)
next
next
Because I am not supposed to access the listbox directly from the thread, I think I must copy all values into a multidimensional array or something like that. My first thought was to have a global multidimensional array and update the array when the listbox changes. Then in the thread use the valued of the array.
The problem is that the number of rows of the listbox is not fixed, so I can’t declare the array with a fixed number of elements. I think there is nothing similar to a push() method for multidimensional arrays.
Any idea on how can I solve this problem? (I don’t care if I use arrays or any other workaround, but I need to have access to the listbox values from within a thread).