Board index » delphi » Splashscreen problem

Splashscreen problem

I have this spalshscreen with a progressbar which increases with a timer.
I'm showing it  at once under my project's source.
My problem is that I want to use showmodal so that the splashscreen repaints
itself and starts the timer. Now I'm using just Show, and stepit every other
line under source. I guess I must use a Thread to use Showmodal, but is this
possible under the projects source, an if,  have anybody any examples of
this..

Please Help

Morten Hauknes

 

Re:Splashscreen problem


Quote
Morten wrote in message <7o8sab$o...@forums.borland.com>...
>I have this spalshscreen with a progressbar which increases with a timer.
>I'm showing it  at once under my project's source.
>My problem is that I want to use showmodal so that the splashscreen
repaints
>itself and starts the timer. Now I'm using just Show, and stepit every
other
>line under source. I guess I must use a Thread to use Showmodal, but is
this
>possible under the projects source, an if,  have anybody any examples of
>this..

>Please Help

>Morten Hauknes

First, I assume that the progress bar is supposed to let the user see how
much longer the splash screen is going to be visible, instead of actually
how long its going to take to initialize the application.

{in the project source, add lines like these...}
  SplashScr := TSplashScr.Create(Application);
  SplashScr.Show;
  SplashScr.Update;

{in the Timer event of the Timer on the splash screen, do something like}

procedure TSplashScr.Timer1Timer(Sender: TObject);
begin
  with ProgressBar do begin
    if Position<Max then
      Position := Position + 1;
    if Position >= Max then
      Close;
  end;
end;

John

Re:Splashscreen problem


Quote

>First, I assume that the progress bar is supposed to let the user see how
>much longer the splash screen is going to be visible, instead of actually
>how long its going to take to initialize the application.

>{in the project source, add lines like these...}
>  SplashScr := TSplashScr.Create(Application);
>  SplashScr.Show;
>  SplashScr.Update;

>{in the Timer event of the Timer on the splash screen, do something like}

>procedure TSplashScr.Timer1Timer(Sender: TObject);
>begin
>  with ProgressBar do begin
>    if Position<Max then
>      Position := Position + 1;
>    if Position >= Max then
>      Close;
>  end;
>end;

>John

Thanks.. but

The problem is that the timer doesn't start before after all the code in the
project's source has run.
What i want is the splashscreen to start with the progressbar going on it's
own with the timer, and at the end of source kill the splashscreen.
If I use Showmodal the timer starts...   but then the rest of the program
stops to until i get rid og the splashscreen.
So the only way i see this is possible is to use a thread where the
splashscreen is running, and another where i start the rest of the program.
I have never used threads before, I've tried(in the source), but with no
luck.

maybe I can make the splashscreen an .exe ... the run it in the source...??

Re:Splashscreen problem


I know that Borland's web site has a good demo of how to do a splash
screen.

Basically, open up the "Project Manager" for your project, right-click
it, and select "View Project Source".
Near the bottom, you will see a bunch of Application.CreateForm(...)
statements.
Make the first one your splash screen.
After that screen is created, show it (not showmodal).
Then, after each of the succeeding Application.CreateForm(...)
statements, just do a "TMyForm.ProgressBar.StepIt" to step through the
progressbar.
After the last one, do a "TMyForm.Close" statement.

This should accomplish what you want.

HTH, Wayne

Quote
Morten wrote:

> I have this spalshscreen with a progressbar which increases with a timer.
> I'm showing it  at once under my project's source.
> My problem is that I want to use showmodal so that the splashscreen repaints
> itself and starts the timer. Now I'm using just Show, and stepit every other
> line under source. I guess I must use a Thread to use Showmodal, but is this
> possible under the projects source, an if,  have anybody any examples of
> this..

> Please Help

> Morten Hauknes

Other Threads