Solved

Im unsure how to create a decent "Idle" procedure for delphi for a splash/logon screen

Posted on 2004-04-19
6
189 Views
Last Modified: 2010-04-05
Im trying to use an OnClick event on splash screen as my logon.
The application should open up to the splash screen and wait for the user to click the image on it before it opens up the logon window.
If they then click cancel on logon I want it to just go an sit back at the splashscreen and wait, rather than continue.
If they click OK and the login is fine, I then want the splash to hide and the app to start.

My main issue is with the "Idle" time.
Im not sure how to just make the application sit and do nothing
0
Comment
Question by:mikelittlewood
  • 3
  • 2
6 Comments
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 100 total points
ID: 10858468

   In Project / Options / Auto-create forms remove your application MainForm - let's say it is frmMain and leave only the SplashForm - let's name it frmSplash.

   Close the frmMain on start up and when whe user press Login - then Show it
0
 
LVL 15

Author Comment

by:mikelittlewood
ID: 10858623
So if I hide the splash screen when they login, and then on the OnClose event of the main form, do frmSplash.Show again to repeat the process

Ill give this a try

Thanks again Ivanov
0
 
LVL 15

Author Comment

by:mikelittlewood
ID: 10858637
I forgot to mention that I would like it to go back to the splashscreen once they close the frmMain again
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10858653
In your splash form assign to the OK button the ModalResult mrOK and to Cancel mrCancel....

then in your project file do this:

program Project1;

uses
  Forms,
  uSplashScreen in '..\uSplashScreen.pas' {SplashForm},
  UMAinForm in '..\UMAinForm.pas' {MainForm};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TSplashForm, SplashForm);
  SplashForm.ShowModal;
  If SplashForm.ModalResult <> 1 then halt;
  SplashForm.Free;
  Application.CreateForm(TMainForm, MainForm);
  Application.Run;
end.
0
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 10858674
--> I forgot to mention that I would like it to go back to the splashscreen once they close the frmMain again

procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
winexec(PChar(ParamStr(0)),SW_ShowNormal);
end;
0
 
LVL 15

Author Comment

by:mikelittlewood
ID: 10863086
In the end I used my splash screen to handle the application.
Click on my splash screen image and it opens a logon form.
With a correct logon it hides the splash and then creates my main datamodule and main form.
When I close the main form I just frmSplash.Show again

Seems to work fine (unless there is something I should be careful of that I have forgotten.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

803 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