Forum > General

How to finish visual changes before doing anything else?


Often I want to change the appearance of a form, and then do a thing that takes a while. What invariably happens is that it half-changes the appearance of the form, and then starts doing the thing, and only finishes changing the form after I've finished the thing, and it looks clunky and bad. Is there any way to make Lazarus do what I want?


You could try "doing the time-consuming thing" in a thread (not in the main GUI loop) so it does not interfere with form GUI updates.

Thanks, howardpc, but that seems a bit heavy-duty. I've never done it, but I looked it up in the Wiki and it says

"Do you need multi-threading?

If you are new to multi-threading and you only want to make your application more responsive while your application performs moderately long-running tasks, then multi-threading may be more than is required."

Now I don't even need my application to be responsive during the tasks, I can't think of any context where that would make sense, I just want it to finish one thing before starting another.

I think the thing it mentions further down in that section about using Application.ProcessMessages instead might be the lightweight alternative I'm looking for.

Yippee, that works perfectly, hurrah. It's been bugging me for ever. OK!


[0] Message Index

Go to full version