Solved

Splash Screen pausing

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

706 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

19 Experts available now in Live!

Get 1:1 Help Now