Question

I created a small form that I want to put on top of other forms when they are working. Basically like a small "Loading... Please wait" notification. It includes an animated TGIFImage. The problem is that when another form is working hard the animation and updating of this form stutters. Probably since they are running in the same thread? Is there a quick and easy way to have this little form always update nicely? Perhaps a quick way to make sure it's handled in it´s own thread?

Was it helpful?

Solution 2

Thanx for the answer Remy Lebeau. I wanted to have to change as little as possible to the existing code though and not move existing code into threads etc. So what I ended up doing was to have a little factory for my notifications that spawns a thread and create the form in that thread. That way I basically only need to wrap my existing code with a Show and a Hide call.

OTHER TIPS

Move the hard work into an actual thread of its own. See the TThread class. Display your Form normally, then start the thread, then close the Form when the thread is done with its work. Have the thread post status updates to the main thread asynchronously if needed (such as for progress bars, etc) so the worker thread is not slowed down waiting for the main thread.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top