SplashScreen with a ProgressBar  

Send By: EberSys
Web : N.A.
Email: EIrigoyen@acsshareds
Date: 02/05/00

Tip accessed 806 times

 


In the tip:

[32] - Display a form while your application is loading (Splash Screen)

it is explained how to make a SplashScreen.

"SplashScreen with progressbar", this thought mainly for when you open databases and it takes a long time loading the program. With the progressbar it is quite well...

First we should define how many " steps " it will have the progressbar, in this case the number of databases that we will open up, then, we establish the Max value of the progressbar for example to 40 and the value Step at 10 and we make 4 " stepit ", it would be in the following way:

This code this in the event OnCreate of a main form, but we could put it in the OnCreate event of another forms.


 procedure TForm1.FormCreate(Sender: TObject);
 begin
   Try
     DataBase1.Connected:=True
   Except
     ShowMessage('Cannot open DB1')
   End;
   SplashForm.ProgressBar.StepIt;
   SplashForm.update;
   Try
     DataBase2.Connected:=True
   Except
     ShowMessage('Cannot open DB2')
   End;
   SplashForm.ProgressBar.StepIt;
   SplashForm.update;
   Try
     Table1.Active:=True
   Except
     ShowMessage('Cannot open Table 1')
   End;
   SplashForm.ProgressBar.StepIt;
   SplashForm.update;
   Try
     Table2.Connected:=True
   Except
     ShowMessage('Cannot open Table 2')
   End;
   SplashForm.ProgressBar.StepIt;
   SplashForm.update;
   ...
   SplashForm.Free
 end;