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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More splash screeen problems

Status
Not open for further replies.

cwolgamott

Programmer
May 29, 2002
69
US
Hello. :) I am modifying a form in Delphi, so that a splash screen will appear, show another form, and then have the splash screen go away. Currently the splash screen appears, then the second form displays, but the splash screen never disappears from behind the second form. Here is the code that displays the splash screen and creates the forms:

//added for splash screen
fsplash := TfSplash.Create(application);
fsplash.Show;
fsplash.Refresh;
//show the screen for 5 seconds
sleep(5000);
fsplash.Hide;
fsplash.Free;
Application.Initialize;
Application.Title := 'GLE Help Desk';
Application.CreateForm(TfMainMenu, fMainMenu);
Application.CreateForm(TAboutBox, AboutBox);
Application.CreateForm(Tfopencase, fopencase);
Application.CreateForm(Tfpriority, fpriority);
Application.CreateForm(Tfrparameters, frparameters);
Application.CreateForm(Tfupdatecomments, fupdatecomments);
Application.CreateForm(Tfusersearch, fusersearch);
Application.CreateForm(Tfcaseresolution, fcaseresolution);
Application.CreateForm(Tfsplash, fsplash);
Application.Run;

I also tried the following code in the FormOpen procedure to free up the resources used by the splash screen:

if (userok = true) then
begin
//free splash screen
fsplash.Free;
//display users cases
myopencases.Execute;
end
else
fmainmenu.close;

I would greatly appreciate any suggestions. :) Thank you. :)
 
Add Application.ProcessMessages after fsplash.Hide;

--- markus
 
Thank you so much for your reply, I greatly appreciate it. :) I tried to put the Application.ProcessMessages after fsplash.Hide, but I still get a bit of a pause. Here is the coding I tried:

//added for splash screen
fsplash := TfSplash.Create(application);
fsplash.Show;
fsplash.Refresh;
//show the screen for 5 seconds
sleep(5000);
//for x := 1 to 2000000000 do
// begin
// y := x;
// end;
//end added for splash screen
fsplash.Hide;
Application.ProcessMessages;
fsplash.Free;
Application.Initialize;
Application.Title := 'GLE Help Desk';
Application.CreateForm(TfMainMenu, fMainMenu);
Application.CreateForm(TAboutBox, AboutBox);
Application.CreateForm(Tfopencase, fopencase);
Application.CreateForm(Tfpriority, fpriority);
Application.CreateForm(Tfrparameters, frparameters);
Application.CreateForm(Tfupdatecomments, fupdatecomments);
Application.CreateForm(Tfusersearch, fusersearch);
Application.CreateForm(Tfcaseresolution, fcaseresolution);
Application.CreateForm(Tfsplash, fsplash);
Application.Run;

I just don't know what I am doing wrong. :( I would greatly appreciate any suggestions or comments that you may have. :) Thank you so much again. :)
 
AFAIR you were already told to remove your splash form from Auto Create forms in your project's options. So your code should look somewhat like this :
Code:
  fsplash := TfSplash.Create(application);
  fsplash.Show;
  Aplication.ProcessMessages;
  Sleep(5000);
  fsplash.Hide;
  Application.ProcessMessages;
  fsplash.Free;
  Application.Initialize;
  Application.Title := 'GLE Help Desk';
  Application.CreateForm(TfMainMenu, fMainMenu);
  Application.CreateForm(TAboutBox, AboutBox);
  Application.CreateForm(Tfopencase, fopencase);
  Application.CreateForm(Tfpriority, fpriority);
  Application.CreateForm(Tfrparameters, frparameters);
  Application.CreateForm(Tfupdatecomments, fupdatecomments);
  Application.CreateForm(Tfusersearch, fusersearch);
  Application.CreateForm(Tfcaseresolution, fcaseresolution);
//  Application.CreateForm(Tfsplash, fsplash); // this line wouldn't be here when you remove splash form from autocreate.
  Application.Run;

--- markus.
 
Hello. :) Sorry, the reason I did not remove the screen from auto-create is that I am only modifying someone's code and they said that they did not think that was necessary. However, I did remove the screen from auto-create and put the code that you mentioned into my source code. However, I am still getting a delay between the time that the splash screen disappears and the main form appears. I would greatly appreciate any suggestions. :) I greatly appreciate your feedback and suggestions. :) Thank you so much. :)
 
Hi,

If you want the main screen to display before the splash is hidden then move the FSplash.Hide to after the Main Form Load.

Example

fsplash := TfSplash.Create(application);
fsplash.Show;
Aplication.ProcessMessages;
Application.Initialize;
Application.Title := 'GLE Help Desk';
Application.CreateForm(TfMainMenu, fMainMenu);
Application.CreateForm(TAboutBox, AboutBox);
Application.CreateForm(Tfopencase, fopencase);
Application.CreateForm(Tfpriority, fpriority);
Application.CreateForm(Tfrparameters, frparameters);
Application.CreateForm(Tfupdatecomments, fupdatecomments);
Application.CreateForm(Tfusersearch, fusersearch);
Application.CreateForm(Tfcaseresolution, fcaseresolution);
// Application.CreateForm(Tfsplash, fsplash); // this line wouldn't be here when you remove splash form from autocreate.


Sleep(5000);
fsplash.Hide;
Application.ProcessMessages;
fsplash.Free;

Application.Run;

Kind Regards, Paul Benn

**** Never Giveup, keep trying, the answer is out there!!! ****
 
Thank you so much for your reply. :) I greatly appreciate it. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top