GUI refresh while waiting for thread to finish


#1

How can I refresh GUI and make application responsive while I'm waiting for thread to finish?

while (!thread.wait(10))
{
//refresh GUI????
}

I found MessageManager::deliverAllPendingMessages but it is no longer implemented.

In C# I can do this with Application.DoEvents. 

 


#2

Find the top-most level Component and call repaint()?


#3

This does not work. Repaint just add message to queue. Problem is that those messages are not processed if application is stucked in a loop. 


#4

Blocking the message thread and periodically forcing it to run to do synchronous paining is an old-school technique that is very dangerous, and is actually impossible on some newer platforms like Android. Don't do it!

The way to do this kind of thing properly is just to do your work on a thread and send messages to your GUI to tell it to repaint when necessary.