Solved

Delphi - Closing Forms on Timer event

Posted on 1998-11-24
7
605 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
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…

805 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