Board index » cppbuilder » Opening Screen

Opening Screen


2004-01-31 12:30:57 AM
cppbuilder20
I have an existing application consisting of a main form plus several child
forms. I'm using the main form's On Create to do some pre-processing, then
the main window appears and I'm ready to go.
Now I need to add an opening window which preceeds the main window, but I
want the pre-processing to continue while the opening window is displayed.
I guess what I want is a splash screen that appears while the preprocessing
takes place.
I tried using OpeningWindow->Show(); or OpeningWindow->Visible=true at the
top of the main form's On Create code, and got an exception. I suppose it's
because the main form has not yet completed opening.
What is the proper process?
Thanks in advance,
Pat
 
 

Re:Opening Screen

Quote
I have an existing application consisting of a main form plus several
child
forms. I'm using the main form's On Create to do some pre-processing,
then
the main window appears and I'm ready to go.
Experts (not me) warmly recomended not to use OnCreate but rather to add
your code to the constructor. OnCreate is buggy.
If you do so, you can create your 'splash window' at runtime (by new) within
the form's constructor, and will work fine.
Quote
Now I need to add an opening window which preceeds the main window, but I
want the pre-processing to continue while the opening window is displayed.
You can do it from within the constructor. Basicly it shows only if Owner
property is set (set it to the main form) and eventually force the draw WN_
message execute by the Form (there is a methode to have a component execute
a Message type by-passing the message queue ( could be in TApplicaton ).
I did something like that with a TFrame quite some time ago, but would have
to search it for the details.
Rgds, Martin
 

Re:Opening Screen

"Pat McClure" < XXXX@XXXXX.COM >wrote in message
Quote
Now I need to add an opening window which preceeds the main
window, but I want the pre-processing to continue while the opening
window is displayed. I guess what I want is a splash screen that
appears while the preprocessing takes place.
Splash screens are common shown inside the project's WinMain() function
itself, ie:
#include<splash.h>
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
//...
TSplashForm *splash = new TSplashForm(Application);
splash->Show();
splash->Update();
Application->CreateForm(__classid(TMainForm), &MainForm);
//...
delete splash;
Application->Run();
//...
}
Gambit
 

{smallsort}

Re:Opening Screen

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote:
Quote

Splash screens are common shown inside the project's WinMain() function
itself, ie:

Which is the classic and 'correct' way, but you can not profit from the IDE
to design it.
This was my Frame version,
- within the Form's contructor
// Loads IniFrame and starts initialization.
TFrameIniSys Fis;
try
{
Fis.FrIniSys=new TFrIniSys(MainForm,GetRectSize(RectSize,RectIniSys));
}
catch(...)
{
Application->MessageBoxA("Major Window Allocation Problem",
"Object Building");
}
// starts initialization function/functions:
// delete Ini Frame;
if(!Fis.TmIniSys->Tag) Fis.Delete();
else Fis.TmIniSys->Tag=0;
- within the Frame constructor
__fastcall TFrIniSys::TFrIniSys(TComponent* Owner,const TRect* ScreenPos)
: TFrame(Owner)
{
Parent=(TWinControl*)Owner;
// Dimensions on TRect, frame and panel
SetBounds(ScreenPos->Left,ScreenPos->Top,
ScreenPos->Width(),ScreenPos->Height());
PnlBorder->SetBounds(0,0,ScreenPos->Width(),ScreenPos->Height());
// Place Label MOEMA at the top, centered
LabMoeIni->Left=0;
LabMoeIni->Top=0;
LabMoeIni->Width=PnlBorder->Width;
Show();
// Starts timer for minimum display time, 3 sec
TmIniSys->Tag=-1;
TmIniSys->Interval=3000;
TmIniSys->Enabled=true;
}
Rgds, Martin
 

Re:Opening Screen

Gosh, Martin, thank you! I'm new to the BCB/C++ world, and insight like
you've given is priceless. (I guess for everything else there's
MasterCard!)
Thanks again,
Pat
"Martin Moeller" < XXXX@XXXXX.COM >wrote in message
Quote

>I have an existing application consisting of a main form plus several
child
>forms. I'm using the main form's On Create to do some pre-processing,
then
>the main window appears and I'm ready to go.

Experts (not me) warmly recomended not to use OnCreate but rather to add
your code to the constructor. OnCreate is buggy.
If you do so, you can create your 'splash window' at runtime (by new)
within
the form's constructor, and will work fine.

>Now I need to add an opening window which preceeds the main window, but
I
>want the pre-processing to continue while the opening window is
displayed.

You can do it from within the constructor. Basicly it shows only if Owner
property is set (set it to the main form) and eventually force the draw
WN_
message execute by the Form (there is a methode to have a component
execute
a Message type by-passing the message queue ( could be in TApplicaton ).

I did something like that with a TFrame quite some time ago, but would
have
to search it for the details.

Rgds, Martin


 

Re:Opening Screen

Ah, once again you've saved my bacon. Thank you. I'll proceed as you
outline, and hope it won't splash too much!
Regards,
Pat
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Pat McClure" < XXXX@XXXXX.COM >wrote in message
news:401a86e3$ XXXX@XXXXX.COM ...

>Now I need to add an opening window which preceeds the main
>window, but I want the pre-processing to continue while the opening
>window is displayed. I guess what I want is a splash screen that
>appears while the preprocessing takes place.

Splash screens are common shown inside the project's WinMain() function
itself, ie:

#include<splash.h>

WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
//...
TSplashForm *splash = new TSplashForm(Application);
splash->Show();
splash->Update();

Application->CreateForm(__classid(TMainForm), &MainForm);
//...

delete splash;
Application->Run();
//...
}


Gambit


 

Re:Opening Screen

"Martin Moeller" < XXXX@XXXXX.COM >wrote in message
Quote
Which is the classic and 'correct' way, but you can not
profit from the IDE to design it.
Yes, you can. The splash screen is still a form like any other. You can
design the form itself normally. The only thing you need to do manually is
instantiate it at runtime via the 'new' operation. The reason being, you
can't use TApplication::CreateForm() for splash screen, as the first form
created by CreateForm() becomes the application's MainForm, and that cannot
be changed once assigned.
Gambit