Solved

Closing a splash screen

Posted on 1998-11-06
4
236 Views
Last Modified: 2010-04-04
I'm wanting to show a splash screen whilst my app starts, but how do I close or destroy it once my main form is active?

I've created the splash by using the Create, Show, Update methods within it's own implementation section.

Thanks in advance
Darren
0
Comment
Question by:elkiors
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 20 total points
ID: 1345941
Hi elkiors,

put code in your application source, like :

{$R *.RES}

var Splashscreen : TSplashScreen;

begin
  SplashScreen := TSplashScreen.Create(Self);
  SplashScreen.Show;
  Application.CreateForm(TAllExamplesForm, AllExamplesForm);
  SplashScreen.Hide;
  SplashScreen.Free;
  Application.Run;
end.

ps. you can use timer to let splashscreen see for a while

Zif.
0
 

Author Comment

by:elkiors
ID: 1345942
Hi Zif,

Thanks alot ... although I did need to change it a bit:


var Splashscreen : TSplashScreen;

begin
  SplashScreen := TSplashScreen.Create(Application); {THIS IS NEW- SELF CREATED AN ERROR}
  SplashScreen.Show;
  SplashScreen.Update; {THIS IS NEW OTHERWISE IT WON'T PAINT}
  Application.CreateForm(TAllExamplesForm, AllExamplesForm);
  SplashScreen.Hide;
  SplashScreen.Free;
  Application.Run;
end.

At least this q didn't run around in circles like the one we just finished on the Update Query stuff

Thanks again

Darren

0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1345943
Hi elkiors,

yep, your correct, I made some mistakes in this one, but it's because it's already a long time ago I made a splash-screen and I thought I still knew it from my head .... seems I don't....

Regards, Zif.
0
 

Expert Comment

by:mami
ID: 1345944
I run my splash in the program.dpr

program Pprogran;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  splash in 'splash.pas' {Fsplash},

{$R *.RES}

begin
  Fsplash := TFsplash.Create(Application);
  Fsplash.Show;
  Fsplash.update; {To paint the splash screen}
  Application.CreateForm(TForm1, Form1);
  Fsplash.Close;
  Fsplash.Free;
  Application.Title := 'Title';
  Application.Run;
end.

and in the unit splash I write.....

unit splash;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TFsplash = class(TForm)
    Panel1: TPanel;
    Image1: TImage;
    procedure FormActivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }

    procedure Delay(Num: longint);

  end;

var
  Fsplash: TFsplash;

implementation

{$R *.DFM}

procedure TFsplash.Delay(Num: longint);
var
   tc :longint;
begin
     tc :=GetTickCount;
     repeat
           Application.ProcessMessages;
     until ((GetTickCount-tc) >= Num);
end;

procedure TFsplash.FormActivate(Sender: TObject);
begin
  Brush.Style := bsClear;
  Delay(5000);
end;

end.

Of this manner I can control the time that want that the splash this active.

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now