Solved

Delphi - Closing Forms on Timer event

Posted on 1998-11-24
7
610 Views
Last Modified: 2012-05-04
I want to close forms in Delphi after a period of time (90 sec), so I put one timer in one form, and set it's OnTimer event so that it show's a screensaver. The timer is set back to the start on KeyDown (Timer.Enabled = false {then true}). It goes to the screensaver, but I don't know how to close a diffrent forms when the onTimer event occurs.
Thanks !!!
0
Comment
Question by:ciuavamitko
  • 4
  • 2
7 Comments
 

Author Comment

by:ciuavamitko
ID: 1347815
Adjusted points to 70
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1347816
? Can you explain your q'n in another way? thanks.

To close form2 from form1 use form2.close;
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 70 total points
ID: 1347817
I think you want to do this:

procedure Form1.Timer1OnTimer(Sender : TObject);

begin
  TheFormToBeClosed.Close;
end;


Cheers,

Raymond.
0
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.

 

Author Comment

by:ciuavamitko
ID: 1347818
This is all true, but I don't know how to close the active Form, when there are about 20 forms that can be active in an application, from the form where the timer is set. I want that the OnTimer event closes the active form, without declaring the form explicitly (like Form2.Close), because ot could be also Form10, or Form20. So I think I need to use Sender or something to close the active window from the non-active window where the timer is.
0
 

Author Comment

by:ciuavamitko
ID: 1347819
This is all true, but I don't know how to close the active Form, when there are about 20 forms that can be active in an application, from the form where the timer is set. I want that the OnTimer event closes the active form, without declaring the form explicitly (like Form2.Close), because ot could be also Form10, or Form20. So I think I need to use Sender or something to close the active window from the non-active window where the timer is.
0
 

Author Comment

by:ciuavamitko
ID: 1347820
This is all true, but I don't know how to close the active Form, when there are about 20 forms that can be active in an application, from the form where the timer is set. I want that the OnTimer event closes the active form, without declaring the form explicitly (like Form2.Close), because ot could be also Form10, or Form20. So I think I need to use Sender or something to close the active window from the non-active window where the timer is.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1347821
To close the active form do this:

Screen.ActiveForm.Close;

Cheers,

Raymond.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 115
Strange behavior when a form is closed 6 61
How to convert memory stream to PDF file 6 108
Tvertscrollbox like a whatsapp layout 5 34
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

839 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