BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Splash screen

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Matthias Knoke
Guest





PostPosted: Mon Apr 19, 2004 6:47 pm    Post subject: Splash screen Reply with quote



Hello,

how to make a splash screen that appears at program start and is visible as
long as my main program is loading some data from a database (can take some
20sec.).
Thanks for the help !

Matthias


Back to top
JD
Guest





PostPosted: Mon Apr 19, 2004 7:26 pm    Post subject: Re: Splash screen Reply with quote



"Matthias Knoke" <Matthias.Knoke (AT) logotek-gmbh (DOT) de> wrote:
Quote:
how to make a splash screen that appears at program start

Add a new form to the project and set it up to look the way
that you want the Splash Screen to look.

Then you need to modify the WinMain (project.cpp). Make it
look like:

#include <vcl.h>
#pragma hdrstop
//-------------------------------------------------------------
USEFORM("Main_Mod.cpp", Main);
// remove the next line
// USEFORM("Splash.cpp", Splash);
USEFORM("AboutMod.cpp", About);
USEFORM("Data_Mod.cpp", DB);
//-------------------------------------------------------------
// add the next line
#include "Splash.h"
//-------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
// add next 3 lines
Splash = new TSplash(Application);
Splash->Show();
Splash->Update();

Application->Initialize();
Application->CreateForm(__classid(TMain), &Main);
Application->CreateForm(__classid(TDB), &DB);
Application->CreateForm(__classid(TAbout), &About);
// add the next 2 lines
Splash->Hide();
Splash->Close();

Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//------------------------------------------------------------

Quote:
and is visible as long as my main program is loading some
data from a database (can take some 20sec.).

The above method will keep it visible as long as it takes to
create the forms. If you put the data loading in the Main
form's constructor, it will stay as long as it takes.

This is not the only way to do it - just the easiest.

~ JD


Back to top
Ramy
Guest





PostPosted: Mon Apr 19, 2004 8:11 pm    Post subject: Re: Splash screen Reply with quote



Sorry for the stupid question, but what is a "Splash screen"??


"JD" <nospam (AT) nospam (DOT) com> wrote:
Quote:

"Matthias Knoke" <Matthias.Knoke (AT) logotek-gmbh (DOT) de> wrote:
how to make a splash screen that appears at program start

Add a new form to the project and set it up to look the way
that you want the Splash Screen to look.

Then you need to modify the WinMain (project.cpp). Make it
look like:

#include <vcl.h
#pragma hdrstop
//-------------------------------------------------------------
USEFORM("Main_Mod.cpp", Main);
// remove the next line
// USEFORM("Splash.cpp", Splash);
USEFORM("AboutMod.cpp", About);
USEFORM("Data_Mod.cpp", DB);
//-------------------------------------------------------------
// add the next line
#include "Splash.h"
//-------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
// add next 3 lines
Splash = new TSplash(Application);
Splash->Show();
Splash->Update();

Application->Initialize();
Application->CreateForm(__classid(TMain), &Main);
Application->CreateForm(__classid(TDB), &DB);
Application->CreateForm(__classid(TAbout), &About);
// add the next 2 lines
Splash->Hide();
Splash->Close();

Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
return 0;
}
//------------------------------------------------------------

and is visible as long as my main program is loading some
data from a database (can take some 20sec.).

The above method will keep it visible as long as it takes to
create the forms. If you put the data loading in the Main
form's constructor, it will stay as long as it takes.

This is not the only way to do it - just the easiest.

~ JD


Back to top
JD
Guest





PostPosted: Mon Apr 19, 2004 8:17 pm    Post subject: Re: Splash screen Reply with quote


"Ramy" <Ramy (AT) NoMail (DOT) com> wrote:
Quote:

Sorry for the stupid question, but what is a "Splash screen"??

It's just a window that appears while the program is loading -
usually something with a logo and/or the company name - and
then disappears when the program starts to run.

~ JD

Please trim your posts. There is no need to include the entire
text from the previouse post. In fact, it's against the guidelines.


Back to top
César
Guest





PostPosted: Mon Apr 19, 2004 10:39 pm    Post subject: Re: Splash screen Reply with quote

Quote:
// add the next 2 lines
Splash->Hide();
Splash->Close();

Application->Run();

should we write also "delete Splash" before "Application->Run()" ?




Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Apr 19, 2004 11:28 pm    Post subject: Re: Splash screen Reply with quote


"César" <kaesar2 (AT) lycos (DOT) es> wrote


Quote:
should we write also "delete Splash" before "Application->Run()" ?

If you don't want the memory used by the splash screen to remain in use
during the lifetime of the program, then yes.

Alternatively, since Matthias did specifically state that he was only
interested in displaying the splash screen during the main form's
initialization, you could just create and display the splash form at the
beginning of the main form's constructor, and then free the splash form at
the end of the constructor, or in AfterConstruction(), or anywhere else that
is an appropriate place to "hide" the splash screen from.


Gambit



Back to top
Matthias Knoke
Guest





PostPosted: Tue Apr 20, 2004 9:20 am    Post subject: Re: Splash screen Reply with quote

Thanks for the help ...
Matthias


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.