Solved

Splash Screen pausing

Posted on 1998-01-14
5
264 Views
Last Modified: 2010-04-04
Here is the code from my Project  Source.

Q. What I would like to do is delay the splash screen (Form_Splash)a bit longer?

The program is small, and the initialisation of the  app. takes a second or two.

program Topo;

uses
  Forms,
  Main in 'Main.pas' {MainForm},
  Errors in 'Errors.pas',
  WriteFld in 'WriteFld.pas',
  About in 'About.pas' {AboutBox},
  Syntax in 'Syntax.pas',
  ReadFld in 'ReadFld.pas',
  DEG_DMS in 'DEG_DMS.pas',
  CodeTable in 'CodeTable.pas' {CodeForm},
  Unit1 in 'Unit1.pas' {Form_Splash},
  WriteObs in 'WriteObs.pas',
  DataCheck in 'DataCheck.pas',
  ReadObs in 'ReadObs.pas',
  asprev in 'Asprev.pas' {PagePreview};

{$R *.RES}

begin
  Application.Initialize;

  Form_Splash := TForm_Splash.Create(Application);
  Form_Splash.Show;
  Form_Splash.Refresh;

  Application.CreateForm(TMainForm, MainForm);
  Application.CreateForm(TAboutBox, AboutBox);
  Application.CreateForm(TCodeForm, CodeForm);
  Application.CreateForm(TForm_Splash, Form_Splash);
  Application.CreateForm(TPagePreview, PagePreview);

  Form_Splash.Hide;
  Form_Splash.Free;

  Application.Run;
end.
0
Comment
Question by:engtech
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 30 total points
ID: 1356595
Put a timer on the splashscreen.
In the OnActivate event, start the timer.
Put at the ontimer event (of TTimer)

procedure TForm_Splash.OnTimer (...);
begin
 Hide;
 Close;
end;

Remove Form_Splash.Hide and Form_Splash.Free

Regards,
Zif.

More info, just ask.
 
0
 

Author Comment

by:engtech
ID: 1356596
Thanks for the quick response
0
 

Author Comment

by:engtech
ID: 1356597
Hello, back again, a slight problem after following what you say - or me either missing something:

After removing Form_Splash.Hide and Form_Splash.Free from the Project Source, placing a timer on the splash form and on Form_Splash.OnActivate event goto procedure OnTimer with code Hide; Close; I get an error of
  "Cannot change Visible in OnShow or OnHide" + a couple of Violation Errors thrown in! Please assist

Ham.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356598
Oops, not so good. Here is a working code example.

In project source :

begin
  Application.Initialize;
  Splashform := TSplashForm.Create(Application);
  SplashForm.Show;
  Splashform.Update;
  Application.Title := 'SENSI-Site';
  Application.Helpfile := 'Sensite.hlp';
  Application.CreateForm(TfMaster, fMaster);
  Application.CreateForm(TKeyDlg, KeyDlg);
  Application.Run;
end.

In splashForm :

unit Splash;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TSplashForm = class(TForm)
    Panel1: TPanel;
    Image1: TImage;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  SplashForm: TSplashForm;

implementation

{$R *.DFM}

procedure TSplashForm.Timer1Timer(Sender: TObject);
begin
 Close;
end;

end.

This should work, because it's in one of my projects i'm working on.

Good luck,

If it doesn't work, just ask again and give some source code to illustrate the possible problem.

Regards,
Zif.
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356599
PS : OnActivate isn't needed if in designtime timer property 'enabled' is set to true.
PPS : Hide isn't needed because you close immediately.


0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question