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

Splash Screen Trouble 1

Status
Not open for further replies.

BobbaFet

Programmer
Feb 25, 2001
903
NL
Hi all,

I looked up in the help screen how to make a splash screen.
I did what it said but it gave me a fatal error with no other errors. I dont know what is wrong.

Does any know a good way to make one?

Thanx allot, BobbaFet Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
 
If by a splash screen you mean a form (with a graphic) it should be straightforward. In the project file organise your code so it looks something like the following (according to form names, etc.)

begin
// Application.Initialize;
Application.Title := 'My Application';
Splash_F := TSplash_F.Create(Application);

Splash_F.Show;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
..
..
..
Splash_F.Hide;
Splash_F.Free;

Application.Run;

Hope that this helps.
Steve
 
Hi StevenK,

I got the splash screen working !!!
It was very easy in fact !!!

The project file looks like this now.

*==========================================*

program Project1;

uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {SplashScreen};

{$R *.RES}

begin
Application.Initialize;
Application.Title := 'CWCon Head Tag Generator';
Application.CreateForm(TSplashScreen, SplashScreen);
SplashScreen.Show;
Application.Run;
end.

*==========================================*

and the Splashscreen unit :

*==========================================*

unit Unit2;

interface

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

type
TSplashScreen = class(TForm)
Panel1: TPanel;
Image1: TImage;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
SplashScreen: TSplashScreen;

implementation

uses Unit1;

{$R *.DFM}

procedure TSplashScreen.Timer1Timer(Sender: TObject);
begin
SplashScreen.Hide;
Application.CreateForm(TForm1, Form1);
SplashScreen.Free;
end;

end.

*==========================================*

I found that it gave me more control in this way.
But it was your code that gave me the idea in the
first place, so thanx allot.

BobbaFet Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
 
Hi
I have had problems with message windows at startup
I used this in tha past to do a splash screen which works fine, it also has a timer on the splash form.
Why do I load the picture from file ? who know these was one of my first delphi Apps.

try
Splash := TSplash.Create(self);
Splash.SplashPic.Picture.LoadfromFile('splash2.bmp');
Splash.showmodal;
except
application.messagebox('Softdrive Monitor System','Saftronics',0);
Splash.free;
end;

In other apps (without a splash screen)
the main window does not maximise behind a message window even if I do a application.maximise first any ideas on how to get around this.
Steve.

 
Hi sggaunt,

What you should do is enable a timer and let the message pop up after you maxise the screen. It shoeld look something like this:

procedure TForm1.FormCreate(Sender: TObject);
begin
... blablablabla ...
Form1.WindowState := wsMaximized;
Timer1.Enabled;
end;

procedure TForm1.Timer1(Sender: TObject);
begin
ShowMessage('Welcome stranger!');
end;

BobbaFet






Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
 
Cheers for that Bobbafet
This is why my splash screen application.maximise works correctly of course, as it has a timer on it.
Things are more complicated as there are lots of different messages, options to quit, list objects to be handled etc. It just means that everything in formactive has to go in the timer event. about as elegant as brick, but if thats the only way.
Sorry for the late response, had to go and write some 'C' Ugg.

Steve..



 
I know its not the most elegeant solution but I say
as long as it works there is nothing to be ashamed about.

BobbaFet Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
 
Believe it or not, I don't like to mess with the Project file, so I usually create and free the splash screen as part of the DataModule OnCreate Event.

This way I also display status messages letting me know if everything is opening up properly on the data files. Here I also open up and retrieve any INI and Registry Settings.

Just another angle for the forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top