Display a form while your application is loading (Splash Screen)  

Send By: Q3 Team
Web : www.q3.nu
Email: dlib@q3.nu
Date: 08/12/99

Tip accessed 1022 times

 


These forms that they appear before starting the application, showing the typical message 'Loading' are idesignated Splash Screens.

You can see one in a demo application included in the Delphi's demos, that it you will will have in: ..\DEMOS\DB\MASTAPP

Basically the operations to accomplish are these:

  • You create a form. (In the example, it is the SplashForm)


  • Do not include it in the list of forms that will autocreate autocargarán upon starting the application.
    This make it in the IDE, in: Project - > Options.
    There you have two lists of windows: the 'Auto-Create forms' and the 'Available Forms'.
    Must puts the form Splash in the 'Available Forms' list, and with this you will make that the form not autocreate.


  • Now we change the source of the project, to make what we want: to show the SplasForm before creating nothing.
    For something which, first must make visible the code source of the project, activating the checkbox that you have in View - >Project Source.
    Once it made this, you will see the code of the project.

    Now then, now must change the code, causing that is created and is shown our window Splash before is created no something else (since is there where the application will delay)


    Watch as makes it the indicated example:


     	begin
     	  SplashForm := TSplashForm.Create(Application);
     	  SplashForm.Show;
     	  SplashForm.Update;
     	  Application.Title := 'Marine Adventures Order Entry';
     	  Application.HelpFile := 'MASTAPP.HLP';
     	  Application.CreateForm(TMastData, MastData);
     	  Application.CreateForm(TMainForm, MainForm);
     	  ...
     	  SplashForm.Hide;
     	  SplashForm.Free;
                       Application.Run;
    



    As you see, first creates the SplashForm and act followed show it, and once made this, continues the normal process of creation the rest of forms.


    Updated at 26/09/99
    Was missing freeing the SplashForm Before the Application.Run (Thanks to Antonio Corvera for report me the mistake)