Solved

Delphi - Closing Forms on Timer event

Posted on 1998-11-24
7
613 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

679 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