Solved

Delphi - Closing Forms on Timer event

Posted on 1998-11-24
7
604 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now