Solved

Stop A Form from Closing

Posted on 1997-08-15
2
176 Views
Last Modified: 2010-04-06
I want to stop a MDI form from closing unless certain criteria is set.  I also want to prevent a form from closing if Ctrl-F4 is pressed.  I know I can stop this two ways, either writing code on the onCloseQuery or setting the Crtl-F4 key press to zero.  My problem is, 1) after setting the criteria in the onCloseQuery - what is the code that actually STOPS the form from closing and 2) how do you set CTRL-F4 to zero?  I'm hoping writing code in the onCloseQuery stops a CTRL-F4 key press, but if it doesn't, I need answers to both questions.
0
Comment
Question by:d4jaj1
[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
2 Comments
 
LVL 1

Accepted Solution

by:
peter_vc earned 20 total points
ID: 1341567
procedure TMDIChild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  { if form not allowed to close then }

     Action := caNone;

  { else }

     Action := caFree;

end;

This should do the trick.

0
 
LVL 3

Author Comment

by:d4jaj1
ID: 1341568
Great Job.  I've asked this question, what seems to be a vey simple question four times, each receiving a wrong answer.  Thanks for finally giving me an answer that works!
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

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…
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 this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

707 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