Lazarus

Programming => General => Topic started by: vfclists on February 14, 2012, 10:32:45 pm

Title: How does FormStyle fsSplash work?
Post by: vfclists on February 14, 2012, 10:32:45 pm
How does FormStype fsSplash work?

Is it meant to run automatically as the first form and disappear when the main form is activated?

Does it require hand coding or will it be automatic?

/vfclists
Title: Re: How does FormStyle fsSplash work?
Post by: Leledumbo on February 15, 2012, 05:27:48 am
Quote
Is it meant to run automatically as the first form and disappear when the main form is activated?
Yes
Quote
Does it require hand coding or will it be automatic?
AFAIK it requires hand coding, setting the style only affects the decoration (no border, no system menu, etc.)
Title: Re: How does FormStyle fsSplash work?
Post by: SassyPenguin on October 19, 2021, 01:33:17 pm
Quote
Does it require hand coding or will it be automatic?

In case if someone is reading, here is the sample implementation of Splash screen during program start up.

Code: Pascal  [Select][+][-]
  1. program SplashTest;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}
  7.   {$IFDEF UseCThreads}
  8.   cthreads,
  9.   {$ENDIF}
  10.   {$ENDIF}
  11.   {$IFDEF Windows}
  12.   Windows,
  13.   {$ENDIF}
  14.   Interfaces,     // this includes the LCL widgetset
  15.   LCLType, Forms,
  16.   FrmMain,       // <====== this is our MAIN Form
  17.   FrmSplash;     // <====== this is splash form unit with "FormStyle = fsSplash"
  18.  
  19. {$R *.res}
  20.  
  21.  
  22. var
  23.   fSplash: TFormSplash;
  24. begin
  25.       RequireDerivedFormResource := True;
  26.       Application.Title:='Splash Demo';
  27.       Application.Scaled:=True;
  28.       Application.Initialize;
  29.  
  30.       fSplash := TFormSplash.Create(Application);                  //Show a splash screen
  31.       fSplash.Show;
  32.       fSplash.Update;
  33.       Application.ProcessMessages;
  34.  
  35.       Application.CreateForm(TFormMain, FormMain);                // Create our main form and initialize any thing that is needed
  36.       {do some initialization here}
  37.  
  38.       fSplash.Close;                                             // close splash screen after everything is ready
  39.       fSplash.Release;
  40.  
  41.       Application.Run;
  42. end.
  43.  
  44.  
TinyPortal © 2005-2018