Delphi and Kylix

Moderators: pritaeas
Number of threads: 7264
Number of posts: 19073

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Need loading time Posted by MTy on 9 Oct 2003 at 2:50 AM
I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.

And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start

Can anyone help me...
Report
Re: Need loading time Posted by Perran on 9 Oct 2003 at 4:22 AM
: I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
:
: And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
:
: Can anyone help me...
:
I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
Report
Re: Need loading time Posted by MTy on 10 Oct 2003 at 8:54 AM
: : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: :
: : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: :
: : Can anyone help me...
: :
: I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
:

I have tryed that I don't work, you see the program still must load up all the images before anything can happen (like showing a nice splashy form) any more ideas?
Report
Re: Need loading time Posted by zibadian on 10 Oct 2003 at 11:54 AM
: : : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: : :
: : : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: : :
: : : Can anyone help me...
: : :
: : I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
: :
:
: I have tryed that I don't work, you see the program still must load up all the images before anything can happen (like showing a nice splashy form) any more ideas?
:
You can show a splash screen before the pictures load. Here is an example code of the project source to show you how to do it:
program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  SplashUnit in 'SplashUnit.pas' {SplashForm};

{$R *.RES}

begin
  SplashForm := TSplashForm.Create(nil); // Create the splash form as first thing
  try
    SplashForm.Show; // and immediately show it
    Application.Initialize; // start to initialize the application
    Application.CreateForm(TForm1, Form1); // and create the other forms
  finally
    SplashForm.Free; // free the splash form
    Application.Run; // run the program itself
  end;
end.

This code assumes that you load the images in the OnCreate() of any other form than the SplashForm. It also assumes that you don't do any lengthy initialization in the "initialization"-part of any of the units.
Report
Re: Need loading time Posted by MTy on 11 Oct 2003 at 6:51 AM
: : : : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: : : :
: : : : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: : : :
: : : : Can anyone help me...
: : : :
: : : I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
: : :
: :
: : I have tryed that I don't work, you see the program still must load up all the images before anything can happen (like showing a nice splashy form) any more ideas?
: :
: You can show a splash screen before the pictures load. Here is an example code of the project source to show you how to do it:
:
: program Project1;
: 
: uses
:   Forms,
:   Unit1 in 'Unit1.pas' {Form1},
:   SplashUnit in 'SplashUnit.pas' {SplashForm};
: 
: {$R *.RES}
: 
: begin
:   SplashForm := TSplashForm.Create(nil); // Create the splash form as first thing
:   try
:     SplashForm.Show; // and immediately show it
:     Application.Initialize; // start to initialize the application
:     Application.CreateForm(TForm1, Form1); // and create the other forms
:   finally
:     SplashForm.Free; // free the splash form
:     Application.Run; // run the program itself
:   end;
: end.
: 

: This code assumes that you load the images in the OnCreate() of any other form than the SplashForm. It also assumes that you don't do any lengthy initialization in the "initialization"-part of any of the units.
:
Hey thanks alot I'll try it out right now
Report
Re: Need loading time Posted by MTy on 11 Oct 2003 at 7:36 AM
: : : : : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: : : : :
: : : : : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: : : : :
: : : : : Can anyone help me...
: : : : :
: : : : I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
: : : :
: : :
: : : I have tryed that I don't work, you see the program still must load up all the images before anything can happen (like showing a nice splashy form) any more ideas?
: : :
: : You can show a splash screen before the pictures load. Here is an example code of the project source to show you how to do it:
: :
: : program Project1;
: : 
: : uses
: :   Forms,
: :   Unit1 in 'Unit1.pas' {Form1},
: :   SplashUnit in 'SplashUnit.pas' {SplashForm};
: : 
: : {$R *.RES}
: : 
: : begin
: :   SplashForm := TSplashForm.Create(nil); // Create the splash form as first thing
: :   try
: :     SplashForm.Show; // and immediately show it
: :     Application.Initialize; // start to initialize the application
: :     Application.CreateForm(TForm1, Form1); // and create the other forms
: :   finally
: :     SplashForm.Free; // free the splash form
: :     Application.Run; // run the program itself
: :   end;
: : end.
: : 

: : This code assumes that you load the images in the OnCreate() of any other form than the SplashForm. It also assumes that you don't do any lengthy initialization in the "initialization"-part of any of the units.
: :
: Hey thanks alot I'll try it out right now
:
Hello again, I have just tryed out the code and it didn't work but I change it alitle and I got the SplashForm to show before everything eles but the problem is that if I put any text or pictures in the SplashForm they won't show... help.
Report
Re: Need loading time Posted by zibadian on 11 Oct 2003 at 10:28 PM
: : : : : : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: : : : : :
: : : : : : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: : : : : :
: : : : : : Can anyone help me...
: : : : : :
: : : : : I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
: : : : :
: : : :
: : : : I have tryed that I don't work, you see the program still must load up all the images before anything can happen (like showing a nice splashy form) any more ideas?
: : : :
: : : You can show a splash screen before the pictures load. Here is an example code of the project source to show you how to do it:
: : :
: : : program Project1;
: : : 
: : : uses
: : :   Forms,
: : :   Unit1 in 'Unit1.pas' {Form1},
: : :   SplashUnit in 'SplashUnit.pas' {SplashForm};
: : : 
: : : {$R *.RES}
: : : 
: : : begin
: : :   SplashForm := TSplashForm.Create(nil); // Create the splash form as first thing
: : :   try
: : :     SplashForm.Show; // and immediately show it
: : :     Application.Initialize; // start to initialize the application
: : :     Application.CreateForm(TForm1, Form1); // and create the other forms
: : :   finally
: : :     SplashForm.Free; // free the splash form
: : :     Application.Run; // run the program itself
: : :   end;
: : : end.
: : : 

: : : This code assumes that you load the images in the OnCreate() of any other form than the SplashForm. It also assumes that you don't do any lengthy initialization in the "initialization"-part of any of the units.
: : :
: : Hey thanks alot I'll try it out right now
: :
: Hello again, I have just tryed out the code and it didn't work but I change it alitle and I got the SplashForm to show before everything eles but the problem is that if I put any text or pictures in the SplashForm they won't show... help.
:
The first thing you need to do in the OnCreate() of the first form you make (form1 in the code above) is call SplashForm.Repaint. This is necessary, because the program will not yet see any repaint commands from windows. If you have a control, which is updated periodically, you need to call its Repaint() method also after each update.
Report
Re: Need loading time Posted by MTy on 12 Oct 2003 at 12:09 AM
: : : : : : : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: : : : : : :
: : : : : : : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: : : : : : :
: : : : : : : Can anyone help me...
: : : : : : :
: : : : : : I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
: : : : : :
: : : : :
: : : : : I have tryed that I don't work, you see the program still must load up all the images before anything can happen (like showing a nice splashy form) any more ideas?
: : : : :
: : : : You can show a splash screen before the pictures load. Here is an example code of the project source to show you how to do it:
: : : :
: : : : program Project1;
: : : : 
: : : : uses
: : : :   Forms,
: : : :   Unit1 in 'Unit1.pas' {Form1},
: : : :   SplashUnit in 'SplashUnit.pas' {SplashForm};
: : : : 
: : : : {$R *.RES}
: : : : 
: : : : begin
: : : :   SplashForm := TSplashForm.Create(nil); // Create the splash form as first thing
: : : :   try
: : : :     SplashForm.Show; // and immediately show it
: : : :     Application.Initialize; // start to initialize the application
: : : :     Application.CreateForm(TForm1, Form1); // and create the other forms
: : : :   finally
: : : :     SplashForm.Free; // free the splash form
: : : :     Application.Run; // run the program itself
: : : :   end;
: : : : end.
: : : : 

: : : : This code assumes that you load the images in the OnCreate() of any other form than the SplashForm. It also assumes that you don't do any lengthy initialization in the "initialization"-part of any of the units.
: : : :
: : : Hey thanks alot I'll try it out right now
: : :
: : Hello again, I have just tryed out the code and it didn't work but I change it alitle and I got the SplashForm to show before everything eles but the problem is that if I put any text or pictures in the SplashForm they won't show... help.
: :
: The first thing you need to do in the OnCreate() of the first form you make (form1 in the code above) is call SplashForm.Repaint. This is necessary, because the program will not yet see any repaint commands from windows. If you have a control, which is updated periodically, you need to call its Repaint() method also after each update.
:
Well I did put the code above in the OnCreate() of the first form but when I compiled the program, the program just stops att the the SplashForm and nothing happends
Report
Re: Need loading time Posted by zibadian on 12 Oct 2003 at 1:34 AM
: : : : : : : : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: : : : : : : :
: : : : : : : : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: : : : : : : :
: : : : : : : : Can anyone help me...
: : : : : : : :
: : : : : : : I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
: : : : : : :
: : : : : :
: : : : : : I have tryed that I don't work, you see the program still must load up all the images before anything can happen (like showing a nice splashy form) any more ideas?
: : : : : :
: : : : : You can show a splash screen before the pictures load. Here is an example code of the project source to show you how to do it:
: : : : :
: : : : : program Project1;
: : : : : 
: : : : : uses
: : : : :   Forms,
: : : : :   Unit1 in 'Unit1.pas' {Form1},
: : : : :   SplashUnit in 'SplashUnit.pas' {SplashForm};
: : : : : 
: : : : : {$R *.RES}
: : : : : 
: : : : : begin
: : : : :   SplashForm := TSplashForm.Create(nil); // Create the splash form as first thing
: : : : :   try
: : : : :     SplashForm.Show; // and immediately show it
: : : : :     Application.Initialize; // start to initialize the application
: : : : :     Application.CreateForm(TForm1, Form1); // and create the other forms
: : : : :   finally
: : : : :     SplashForm.Free; // free the splash form
: : : : :     Application.Run; // run the program itself
: : : : :   end;
: : : : : end.
: : : : : 

: : : : : This code assumes that you load the images in the OnCreate() of any other form than the SplashForm. It also assumes that you don't do any lengthy initialization in the "initialization"-part of any of the units.
: : : : :
: : : : Hey thanks alot I'll try it out right now
: : : :
: : : Hello again, I have just tryed out the code and it didn't work but I change it alitle and I got the SplashForm to show before everything eles but the problem is that if I put any text or pictures in the SplashForm they won't show... help.
: : :
: : The first thing you need to do in the OnCreate() of the first form you make (form1 in the code above) is call SplashForm.Repaint. This is necessary, because the program will not yet see any repaint commands from windows. If you have a control, which is updated periodically, you need to call its Repaint() method also after each update.
: :
: Well I did put the code above in the OnCreate() of the first form but when I compiled the program, the program just stops att the the SplashForm and nothing happends
:
Strange, in my test project it worked perfectly. Could you post the first part of the OnCreate() here? Also have you got any lengthy processes in the SplashForm?
Report
Re: Need loading time Posted by MTy on 12 Oct 2003 at 2:46 AM
: : : : : : : : : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: : : : : : : : :
: : : : : : : : : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: : : : : : : : :
: : : : : : : : : Can anyone help me...
: : : : : : : : :
: : : : : : : : I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
: : : : : : : :
: : : : : : :
: : : : : : : I have tryed that I don't work, you see the program still must load up all the images before anything can happen (like showing a nice splashy form) any more ideas?
: : : : : : :
: : : : : : You can show a splash screen before the pictures load. Here is an example code of the project source to show you how to do it:
: : : : : :
: : : : : : program Project1;
: : : : : : 
: : : : : : uses
: : : : : :   Forms,
: : : : : :   Unit1 in 'Unit1.pas' {Form1},
: : : : : :   SplashUnit in 'SplashUnit.pas' {SplashForm};
: : : : : : 
: : : : : : {$R *.RES}
: : : : : : 
: : : : : : begin
: : : : : :   SplashForm := TSplashForm.Create(nil); // Create the splash form as first thing
: : : : : :   try
: : : : : :     SplashForm.Show; // and immediately show it
: : : : : :     Application.Initialize; // start to initialize the application
: : : : : :     Application.CreateForm(TForm1, Form1); // and create the other forms
: : : : : :   finally
: : : : : :     SplashForm.Free; // free the splash form
: : : : : :     Application.Run; // run the program itself
: : : : : :   end;
: : : : : : end.
: : : : : : 

: : : : : : This code assumes that you load the images in the OnCreate() of any other form than the SplashForm. It also assumes that you don't do any lengthy initialization in the "initialization"-part of any of the units.
: : : : : :
: : : : : Hey thanks alot I'll try it out right now
: : : : :
: : : : Hello again, I have just tryed out the code and it didn't work but I change it alitle and I got the SplashForm to show before everything eles but the problem is that if I put any text or pictures in the SplashForm they won't show... help.
: : : :
: : : The first thing you need to do in the OnCreate() of the first form you make (form1 in the code above) is call SplashForm.Repaint. This is necessary, because the program will not yet see any repaint commands from windows. If you have a control, which is updated periodically, you need to call its Repaint() method also after each update.
: : :
: : Well I did put the code above in the OnCreate() of the first form but when I compiled the program, the program just stops att the the SplashForm and nothing happends
: :
: Strange, in my test project it worked perfectly. Could you post the first part of the OnCreate() here? Also have you got any lengthy processes in the SplashForm?
:
Okej this is exacly how I have done, try to see if you can find any misstake:

procedure TForm1.FormCreate(Sender: TObject);
begin
SplashForm := TSplashForm.Create(nil);
try
SplashForm.Show;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
finally
SplashForm.Free;
Application.Run;
end;
end;

And when I compile this the SplashForm will show but after that nothing happends the program just freezes up and I can't do anything but use the "Program reset" button

But one part of your code I didd't understand was:

uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
SplashUnit in 'SplashUnit.pas' {SplashForm};

Because when I add this part under the "uses" I can't compile the program. But as I said I changed the code to:

procedure TForm1.FormCreate(Sender: TObject);
begin
SplashForm := TSplashForm.Create(nil);
SplashForm.Show;
end;

And now the SplashForm shows before everything and when all the pictures have been loaded the first from will appeare BUT on images of text will be shown on the SplashForm
Report
Re: Need loading time Posted by Perran on 12 Oct 2003 at 4:23 AM
: : : : : : : : : : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: : : : : : : : : :
: : : : : : : : : : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: : : : : : : : : :
: : : : : : : : : : Can anyone help me...
: : : : : : : : : :
: : : : : : : : : I'm not sure what you mean by "loading time", but why don't make a nice splash form and put that up while your program is loading and initializing?
: : : : : : : : :
: : : : : : : :
: : : : : : : : I have tryed that I don't work, you see the program still must load up all the images before anything can happen (like showing a nice splashy form) any more ideas?
: : : : : : : :
: : : : : : : You can show a splash screen before the pictures load. Here is an example code of the project source to show you how to do it:
: : : : : : :
: : : : : : : program Project1;
: : : : : : : 
: : : : : : : uses
: : : : : : :   Forms,
: : : : : : :   Unit1 in 'Unit1.pas' {Form1},
: : : : : : :   SplashUnit in 'SplashUnit.pas' {SplashForm};
: : : : : : : 
: : : : : : : {$R *.RES}
: : : : : : : 
: : : : : : : begin
: : : : : : :   SplashForm := TSplashForm.Create(nil); // Create the splash form as first thing
: : : : : : :   try
: : : : : : :     SplashForm.Show; // and immediately show it
: : : : : : :     Application.Initialize; // start to initialize the application
: : : : : : :     Application.CreateForm(TForm1, Form1); // and create the other forms
: : : : : : :   finally
: : : : : : :     SplashForm.Free; // free the splash form
: : : : : : :     Application.Run; // run the program itself
: : : : : : :   end;
: : : : : : : end.
: : : : : : : 

: : : : : : : This code assumes that you load the images in the OnCreate() of any other form than the SplashForm. It also assumes that you don't do any lengthy initialization in the "initialization"-part of any of the units.
: : : : : : :
: : : : : : Hey thanks alot I'll try it out right now
: : : : : :
: : : : : Hello again, I have just tryed out the code and it didn't work but I change it alitle and I got the SplashForm to show before everything eles but the problem is that if I put any text or pictures in the SplashForm they won't show... help.
: : : : :
: : : : The first thing you need to do in the OnCreate() of the first form you make (form1 in the code above) is call SplashForm.Repaint. This is necessary, because the program will not yet see any repaint commands from windows. If you have a control, which is updated periodically, you need to call its Repaint() method also after each update.
: : : :
: : : Well I did put the code above in the OnCreate() of the first form but when I compiled the program, the program just stops att the the SplashForm and nothing happends
: : :
: : Strange, in my test project it worked perfectly. Could you post the first part of the OnCreate() here? Also have you got any lengthy processes in the SplashForm?
: :
: Okej this is exacly how I have done, try to see if you can find any misstake:
:
: procedure TForm1.FormCreate(Sender: TObject);
: begin
: SplashForm := TSplashForm.Create(nil);
: try
: SplashForm.Show;
: Application.Initialize;
: Application.CreateForm(TForm1, Form1);
: finally
: SplashForm.Free;
: Application.Run;
: end;
: end;
:
: And when I compile this the SplashForm will show but after that nothing happends the program just freezes up and I can't do anything but use the "Program reset" button
:
: But one part of your code I didd't understand was:
:
: uses
: Forms,
: Unit1 in 'Unit1.pas' {Form1},
: SplashUnit in 'SplashUnit.pas' {SplashForm};
:
: Because when I add this part under the "uses" I can't compile the program. But as I said I changed the code to:
:
: procedure TForm1.FormCreate(Sender: TObject);
: begin
: SplashForm := TSplashForm.Create(nil);
: SplashForm.Show;
: end;
:
: And now the SplashForm shows before everything and when all the pictures have been loaded the first from will appeare BUT on images of text will be shown on the SplashForm
:
What Zibadian showed you was the *Project Source*. I think you've conflated that and the unit source. Try removing everything from that OnCreate handler and just put the repaint within the try..finally block. The idea here is create the splash screen and show it, to let the program itself create forms and all, and then to destroy splash screen.
Report
Re: Need loading time Posted by MTy on 12 Oct 2003 at 6:51 AM
: I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
:
: And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
:
: Can anyone help me...
:
hehe I know I'm slow but now finally your wise word has got through to me and I now understand what you guys mean and I have now done so and it works great but the slashform still woun't show any pictures or text, just a blank form I mean I just want a text sayng something like "loading in progress"
Report
Re: Need loading time Posted by zibadian on 12 Oct 2003 at 7:53 AM
: : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: :
: : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: :
: : Can anyone help me...
: :
: hehe I know I'm slow but now finally your wise word has got through to me and I now understand what you guys mean and I have now done so and it works great but the slashform still woun't show any pictures or text, just a blank form I mean I just want a text sayng something like "loading in progress"
:
You need to call the Repaint method after showing it. After the SplashForm.Show() line, add "SplashForm.Repaint". This will force the form to paint itself correctly. You can also place that call as the first statement in the OnCreate() of the mainform.
Report
Re: Need loading time Posted by MTy on 12 Oct 2003 at 12:00 PM
: : : I have made a program containing many big pictures and when I start the program on a slower computer then mine it takes some time for the program start.
: : :
: : : And I know that I could just put the pictures in a folder and have the program load them when they are to be shown but I want to hav all the pictures in the program so what I need is some kind of loading time when the program start
: : :
: : : Can anyone help me...
: : :
: : hehe I know I'm slow but now finally your wise word has got through to me and I now understand what you guys mean and I have now done so and it works great but the slashform still woun't show any pictures or text, just a blank form I mean I just want a text sayng something like "loading in progress"
: :
: You need to call the Repaint method after showing it. After the SplashForm.Show() line, add "SplashForm.Repaint". This will force the form to paint itself correctly. You can also place that call as the first statement in the OnCreate() of the mainform.
:
GREAT now everything works perfecly thanks alot you guys



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.