I have a button in a window that opens a new window and embeds a number of containers in a For loop (the progress of which is shown using a separate dialog window containing a progress bar).
Each container is actually an entire invoice. The purpose of this window is to show a number of invoices and to be able to scroll through them to review a selection of invoices (and to make corrections, if necessary).
This actually works quite well.
Code looks something like this:
//Count the number of invoices checked in the listbox
For i = 0 to lb.ListCount-1
If lb.CellTag(i,0) = 1 then
NumOfInvoices = NumOfInvoices + 1
End If
Next
// Init progressDialog
progressDialog.init("Preparing INVOICE Forms", True, True)
progressDialog.startProgress("Counting...", NumOfInvoices)
For i = 0 to lb.ListCount-1
progressDialog.updateProgress("", 1)
If UserCancelled Then
progressDialog.Close
INVOICE_window(w).Close
Return
Exit
End If
If lb.CellTag(i,0) = 1 then //the invoice is selected to be displayed
Dim c as New INVOICE_Container
INVOICE_Container(c).EmbedWithin( INVOICE_window(w), 0, vHeight)
//Place the invoice number in the field in the INVOICE_Container
INVOICE_Container(c).vInvNumber.Text = lb.Cell(i,4)
vHeight = vHeight + INVOICE_Container(c).Height - 800
INVOICE_window(w).ccList.Append c //keep track of the containers in the window in an array
//Adjust the scroll bar settings for the window
INVOICE_window(w).ScrollBar1.Maximum = INVOICE_window(w).ScrollBar1.Maximum + INVOICE_Container(c).Height
End if
Next
progressDialog.Close
When the invoice number is loaded in the invoice, it looks up the data and loads all the fields of the invoice.
This process does take some time to load (about 3 seconds per invoice), and does lock up the user interface while the process is running.
Now, I am finding that in El Capitan the progress bar is invisible (all other version of Mac OS X work fine).
I realize that the proper way to correct this is to move the work into a Thread and then use a Timer to update the progress while the window is being prepared. From all I have read, I don’t believe it is possible to load containers into a window from within a thread.
What would be the preferred way to address this issue?