Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Splash Screen pausing

Posted on 1998-01-14
5
Medium Priority
?
270 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 120 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

916 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