Note that there are some explanatory texts on larger screens.

plurals
  1. POWhich is the best place to initialize code?
    text
    copied!<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/3359638/splash-screen-programatically">Splash Screen Programatically</a><br> <a href="https://stackoverflow.com/questions/10678503/show-a-splash-screen-while-a-database-connection-that-might-take-a-long-time-r">Show a splash screen while a database connection (that might take a long time) runs</a> </p> </blockquote> <p>Which is the best place to initialize code such as loading INI file? I want first to show the form on screen so the user know that the app is loading and ONLY after that I want to call lengthy functions such as LoadIniFile or IsConnectedToInternet (the last one is REALLY slow).</p> <p>The OnCreate is not good because the form is not yet ready and it will not show up on screen.</p> <p>I do this I DPR but not working always:</p> <pre><code>program Test; begin Application.Initialize; Application.Title := 'Test app'; Application.CreateForm(TfrmTest, frmTest); frmTest.Show; &lt;---------------------- won't show LateInitialize; Application.Run; end. </code></pre> <p>The form will not show until LateInitialize (4-5 seconds) is executed.</p> <hr> <pre><code>procedure LateInitialize; begin CursorBussy; TRY // all this won't work also. the form won't show frmTest.Visible:= TRUE; Application.ProcessMessages; frmTest.Show; Application.ProcessMessages; frmTest.BringToFront; frmTest.Update; Application.ProcessMessages; DoSomethingLengthy; {4-5 seconds} FINALLY CursorNotBussy; END; end; &lt;--------- Now the form shows. </code></pre> <p>And yes, frmTest it is my only form (the main form).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload