Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make a SplashScreen

How To

Make a SplashScreen

by  BobbaFet  Posted    (Edited  )
What is a splashscreen?

A splashscreen is an image shown to the user while the rest
of the program loads. This tells us two things:
1. The splashscreen is NEVER the mainform of the project.
2. It will need to be closed (or at least hidden) at some point.

Making the splashscreen itself is very simple:
------ METHOD 1:
- First go to "Project | Options":
Here you set the SplashScreen form to auto-create and the
mainform of the project to available.
- Next take a TImage and drop it on the form that you wish
to use as the splashscreen. Drop on that same form a TTimer.
Set the timer to the amount you want. Next you'll
have to code what happens when the timer runs out, namely:
Create the mainform. Something like:
Application.CreateForm(TForm1,Form1); should get the
desired results.

The final step is to have the mainform dispose of the
splashscreen. So you'll have to do something called form
linking to let the mainform access the splashscreen:

First make the mainform unit the unit you are currently
viewing. Press Alt-F11 or go to "File | Use Unit" to
select the splashscreen unit and hit Ok. Now you can add
where ever you want the code to close the splashscreen.
(I personally prefer the onCreate event of the main form)

------ METHOD 2:
I only use this one if the loading of the mainform takes
subtantial time:

I have both forms auto-create. Obviously, the user won't
see the mainform until the onCreate event has finished.
Therefore you can use the form linking (see above) in the
most simple way, link the splashscreen to the mainform and
just add as the last line of code of the onCreate event the
something like mySplash.Close; or mySplash.Hide; if you
plan to store variables there for other units.

This will cause the splashscreen to disappear as the
mainform appears.
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top