Cannot update screen on web project

I have a listbox on a page and a button to go and retrieve data to populate the listbox. Due to mobile latency etc I want to display a “Please Wait” dialog box whilst the data is getting read from the database and stored in an array and then populates the listbox. I have it all working accept when I ask for the dialog to be shown when the “mouse up” event occurs the dialog is never shown and the listbox eventually populates. I have intentionally done a query to pull back 10,000 rows so that I can see the dialog but I am not seeing it even thought the listbox takes about 4 seconds to populate. Example code below:

[code]dim dlg as new dlgPleaseWait
dlg.show
app.YieldToNextThread

// Get data from database and populate listbox

dlg.hide[/code]

You’ll need to break your code into two or more pieces. Remember all of the code you have in that event must execute before anything gets sent back to the browser. My suggestion is:

  1. Create and show the dialog
  2. Start a thread to get data from the database
  3. Start a timer which watches the thread to see when it’s complete
  4. When the thread is complete, populate the listbox and hide the dialog.

Thanks Greg, I had asked a question about this before but didnt realise it was the same issue (sorry for asking twice). Just so I get it 100% clear in my head, everything that is done in an event happens server site and the whole event has to complete before anything is passed back to the client, is that correct?

Right.

Ok then it would be useful in a future release to be able to have something like the DoEvents that told the server to send changes made on the server back to the client thereby allowing things like this and other things to be done without having to have timers and threads etc. Is this worth putting on the Feedback system or is it just my lack of understanding of Xojo?