ProgressBar and app GUI stop responding after a couple of seconds of a process

Hi everybody…

I have a method that collects a lot of data from the DB and computes it… it is quite slow, and probably poorly written… but until I learn how to code it better I decided I will display a progressbar with a label stating “Processing day x” (for all the days in the period it has to process) so the user does not think that has crashed or frozen…

It works OK… until day 5— 6-- or so… then I get the windows spinning symbol and the windows title bar says "(not responding) and stops updating!!

So the whole process takes about a minute… it works ok for a couple of seconds but then the progress bar and its windows will stop updating…

Please Help…

Do you collect the data in an own thread?
I experienced that this is a good solution to stay responsive with the UI.

I don’t think I know how to do it… Any clues, tips, code or places to start reading about it ?

There are several sample projects in the Xojo program folder.
Maybe you take a look at the UIThreadingWithTask or UIThreadingWithTimer project.

I still don’t get it… how do I pass UI information (like a popmenu selection) to a process running on a thread…?

Make a thread subclass that has properties you can set. Grab the info from the UI and set the properties, then run the thread and use the property values you stored rather than asking the interface.

Here are some:

Thanks guys! I’ll do my homework and read what Paul suggested. In the meantime I realized I could refactor,fix and optimize my code to make it run 300% faster. So its not that important anymore. :slight_smile: