Recent

Author Topic: [SOLVED] Splash Screen  (Read 2317 times)

Pe3s

  • Hero Member
  • *****
  • Posts: 647
[SOLVED] Splash Screen
« on: April 22, 2022, 04:31:28 pm »
Hello, how can I make the Welcome Screen, I tried to insert the code in the project source but there is an error
Code: Pascal  [Select][+][-]
  1.  FSplash := TFSplash.Create(Application);
  2.   FSplash.Show;
  3.   Application.Initialize;

How can I display the splash form before the main program form?

« Last Edit: April 22, 2022, 07:50:01 pm by Pe3s »

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Splash Screen
« Reply #1 on: April 22, 2022, 04:53:52 pm »
What error?

I have this (in *.lpr), it works:
Code: Pascal  [Select][+][-]
  1.   RequireDerivedFormResource:=True;
  2.   Application.Initialize;
  3.  
  4.   FrmSplash:=TFrmSplash.Create(nil);
  5.   FrmSplash.Show;
  6.   Application.ProcessMessages;
  7.  
  8.   Application.CreateForm(TFrmMain, FrmMain);
  9.    
  10.   FrmMain.Show;
  11.   FreeThenNil(FrmSplash);
  12.   Application.Run;
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Pe3s

  • Hero Member
  • *****
  • Posts: 647
Re: Splash Screen
« Reply #2 on: April 22, 2022, 05:37:56 pm »
Error  Execution Stopped with exit-code 217 ($00D9)

wp

  • Hero Member
  • *****
  • Posts: 13572
Re: Splash Screen
« Reply #3 on: April 22, 2022, 06:50:24 pm »
In the attachment there is a tested demo. To see something happening I added a progress bar to the splash form (I did not use a TProgressbar because it causes trouble sometimes).

Pe3s

  • Hero Member
  • *****
  • Posts: 647
Re: Splash Screen
« Reply #4 on: April 22, 2022, 07:49:43 pm »
Thank you @wp, I will look for the error at my place

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: [SOLVED] Splash Screen
« Reply #5 on: April 22, 2022, 09:01:53 pm »
@wp
For some reason in your attachment the splash form .lfm is named usplash.lfm while the unit's .pas is named uSplash.pas.
On Windows this does not matter, but on Mac and Linux the project will not compile unless you rename the usplash.lfm to uSplash.lfm.

wp

  • Hero Member
  • *****
  • Posts: 13572
Re: [SOLVED] Splash Screen
« Reply #6 on: April 22, 2022, 10:09:24 pm »
Howard, thanks for the hint. Creating this project was a bit chaotic because I fell into the trap again that a SaveAs does not necessarily refer to the file visible in the editor. This way I saved the project under the wrong name and had a lot to do to repair the project again. This must have been where the error crept in.

PascalDragon

  • Hero Member
  • *****
  • Posts: 6398
  • Compiler Developer
Re: [SOLVED] Splash Screen
« Reply #7 on: April 23, 2022, 12:18:15 pm »
Hello, how can I make the Welcome Screen, I tried to insert the code in the project source but there is an error
Code: Pascal  [Select][+][-]
  1.  FSplash := TFSplash.Create(Application);
  2.   FSplash.Show;
  3.   Application.Initialize;

A part of your problem is that you need to insert your code after Application.Initialize. There might be other issues as well as I usually don't work with splash screens, but that one is definitely an issue.

 

TinyPortal © 2005-2018