Solved

Splash Screen pausing

Posted on 1998-01-14
5
262 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now