On Wed, 12 Dec 2007 15:17:18 -0800
el stamatakos <[EMAIL PROTECTED]> wrote:

> 
> Hi All,
>  I am trying to use a splash screen before my main application
> starts. I use the following. Does anyone see anything wrong with the
> below since it does not seem to bring up the Splash Screen. Thanks

A few things.

 
> Lefti
> ------------------------------------------unit
> Splash------------------------------------------------------------------------------
> unit Splash;
> 
> {$mode objfpc}{$H+}
> 
> interface
> 
> uses
>   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs,
> ExtCtrls, StdCtrls;
> 
> type
> 
>   { TSplashForm }
> 
>   TSplashForm = class(TForm)
>     Image1: TImage;
>     Label1: TLabel;
>     Label2: TLabel;
>     procedure FormCreate(Sender: TObject);
>   private
>     { private declarations }
>   public
>     { public declarations }
>   end; 
> 
> var
>   SplashForm: TSplashForm;
> 
> implementation
> 
> { TSplashForm }
> 
> procedure TSplashForm.FormCreate(Sender: TObject);
> begin
>   sleep(20000);

remove this sleep.

> end;
> 
> initialization
>   {$I splash.lrs}
> 
> end.       
> 
> ------------------------------------------unit
> Splash------------------------------------------------------------------------------
> 
> ------------------------------------------Main
> project-----------------------------------------------------------------------------
> program project1;
> 
> {$mode objfpc}{$H+}
> 
> uses
>   {$IFDEF UNIX}{$IFDEF UseCThreads}
>   cthreads,
>   {$ENDIF}{$ENDIF}
>   Interfaces, // this includes the LCL widgetset
>   Forms
>   { you can add units after this }, SQLDBLaz, ProcessDesChild, Unit1, 
> SharedVarsU, SharedLibsU, Splash;
> 
> begin

move the application.Initialize to here.

> SplashForm:=TSplashForm.Create(Application);

replace the owner with nil
  :=TSplashForm.Create(nil);

> SplashForm.Show;
> SplashForm.Paint;
> SplashForm.Update;

remove the paint and the update.

> application.ProcessMessages;
> application.Initialize;

remove the application.Initialize

> //Delay(2000);
>   Application.Initialize;

remove the application.Initialize


>   Application.CreateForm(TMainForm, MainForm);
>   SplashForm.Hide;
>   SplashForm.Close;
>   SplashForm.Release;
>   SplashForm.Free;

Just Free.

>   Application.Run;
> end.


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to