My system is windows 10 and Delphi 10.4.
I have several applications that work fine, they just look very ugly on startup.
The main issue is that I save the main window state when the application shuts down, such as window state, size, position etc and then restore them at start up.
I restore the main window parameters in the mainform oncreate event from an ini file and in the onactivate event, I load the program dynamic content from a project file.
Loading the project file may take 10 seconds or so, but in the meantime, the window has scaled to its final size (ie maximised) but all the main form visual components are still in their design time sizes.
It all sorts itself out once the project file has loaded, it just looks so ugly during that startup process.
I've tried all sorts of combinations of application.processmessages, update, refresh etc before loading the project file but nothing works in the onactivate event.
Weirdly, I tried to printscreen so I could post a picture of the effect but the resultant picture looked fine, so I am guessing it something held up in the graphics pipeline during application startup.
Is there an event that fires after the mainwindow has finished all its processing, so I can then start the dynamic content loading?
OnCreate
-- notOnActivate
(which may fire several times, not only on app startup). – Andreas RejbrandOnActivate
handler tonil
). In any case, if loading takes 10 seconds, you should do it in a background thread. You shouldn't block the GUI thread that long. (I assume this 10-second loading does non-GUI stuff. If you are spending 10 seconds rearranging controls on a form, something is seriously wrong!) – Andreas Rejbrand