Solved

Delphi - Closing Forms on Timer event

Posted on 1998-11-24
7
617 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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