Board index » delphi » splash form while initialising.

splash form while initialising.

I am building a level editor that needs a lot of initialising.
This means my main form takes a long time before it shows up.

I wanted to show a splash window in the meanwhile.
Someone told me it was doable with two threads. Start up a form
in every thread and check if the other form is initialised yet.

The problem is: how can I start two forms in two theads?
Or: is there a more simple way to achieve this...

Hans.
--
--------------------------------------------------------
   Hans Van Es (Hans.Va...@advalvas.be)

   Eve Crew Game Programming Team:
      http://www.thewatercooler.com/evecrew    
--------------------------------------------------------

 

Re:splash form while initialising.


No threads needed. Just display it before initialization code:
begin
  Splash := TSplash.Create(nil);
  Splash.Show;
  Splash.Update;
  Application.CreateForm(TMainform,MainForm);
  {some other initialization}
  Splash.Free;
  Application.Run;
end.

--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.qwe.ce...@neosys.xrs.qwe.si

No questions via email, unless explicitly invited.

Re:splash form while initialising.


Well, it is very simple.

Just create your splash form as you would any other.
Then, in project (DPR) file, where an application initialises,
exactly after the statement that creates your main form
- it could look like Application.CreateForm(TMainForm, MainForm) -
add the line that will create and display your splash form:

Application.CreateForm(TSplashForm, SplashForm);
SplashForm.Show;
SplashForm.Refresh;

Then your form will be shown immediately after creation. Of course, set your
splash
form's property BorderStyle to bsNone to hide it's caption.

Only remains to close and free the splash form after your main form is
finished with the
initialisation (SplashForm.Close; SplashForm.Free)

OK?

Hans Van Es <Hans.Va...@advalvas.be> wrote in message
news:373019E4.739E40E9@advalvas.be...

Quote
> I am building a level editor that needs a lot of initialising.
> This means my main form takes a long time before it shows up.

> I wanted to show a splash window in the meanwhile.
> Someone told me it was doable with two threads. Start up a form
> in every thread and check if the other form is initialised yet.

> The problem is: how can I start two forms in two theads?
> Or: is there a more simple way to achieve this...

> Hans.
> --
> --------------------------------------------------------
>    Hans Van Es (Hans.Va...@advalvas.be)

>    Eve Crew Game Programming Team:
>       http://www.thewatercooler.com/evecrew
> --------------------------------------------------------

Re:splash form while initialising.


Hi !

When you free your splash form, the app terminates. The little trick lies in creating the splash
screen with:

  SplashForm:=TSplashForm.Create(Application); // This does not make the form the app's main form

instead of:

  Application.CreateForm(TSplashForm, SplashForm); // This makes the form the app's main form, if
created first.

Bjoerge

-------------------------------------
Bj?rge S?ther
REMOVETHIS_bsaet...@online.no

Davor Pleskina skrev i meldingen <7gpmhs$mb...@as102.tel.hr>...

Quote
>Well, it is very simple.

>Just create your splash form as you would any other.
>Then, in project (DPR) file, where an application initialises,
>exactly after the statement that creates your main form
>- it could look like Application.CreateForm(TMainForm, MainForm) -
>add the line that will create and display your splash form:

>Application.CreateForm(TSplashForm, SplashForm);
>SplashForm.Show;
>SplashForm.Refresh;

>Then your form will be shown immediately after creation. Of course, set your
>splash
>form's property BorderStyle to bsNone to hide it's caption.

>Only remains to close and free the splash form after your main form is
>finished with the
>initialisation (SplashForm.Close; SplashForm.Free)

>OK?

>Hans Van Es <Hans.Va...@advalvas.be> wrote in message
>news:373019E4.739E40E9@advalvas.be...
>> I am building a level editor that needs a lot of initialising.
>> This means my main form takes a long time before it shows up.

>> I wanted to show a splash window in the meanwhile.
>> Someone told me it was doable with two threads. Start up a form
>> in every thread and check if the other form is initialised yet.

>> The problem is: how can I start two forms in two theads?
>> Or: is there a more simple way to achieve this...

>> Hans.
>> --
>> --------------------------------------------------------
>>    Hans Van Es (Hans.Va...@advalvas.be)

>>    Eve Crew Game Programming Team:
>>       http://www.thewatercooler.com/evecrew
>> --------------------------------------------------------

Other Threads