Progress Window + Message Manager Lock

Thanks in advance for the help. I was looking at ThreadWithProgressWindow and thought it would be useful to do a long running task: importing + parsing a file then building a TableListBox to display the file contents. However, a good chunk of this task is spent manipulating components, which requires either a lock on the Message Manager, or being on the GUI thread.

I haven’t yet tried it, but will/how will the progress bar be able to stay updated/animated if my worker task has locked/is working on the message thread?

It might as well be on the GUI thread if you have to lock the MM anyways. My first thought is to build a state machine that runs some of the task and then yeilds for another loop through the MM, then runs some more, etc… welcome to co-operative mutlitasking!!! :wink:

Simple answer: it won’t – and not gonna be of any good use in that case anyway. The MessageThread basically drives the entire application. If it lags doing stuff, then you can expect your user to experiencing your application lagging.

I read from a few in this forum, that it is possible to create and setup components off the message thread before making them visible and adding them as a child, but you’d for sure need to loose some assertions. I personally haven’t tried that yet.

Thanks for the information, guys… and for the warm welcome… it is indeed the first time I have had to consider this!

I will see if I can break the task up a little and and post chunks to the message queue with callAsync or something to start with. Thanks for steering me in the right direction.

1 Like