?
Solved

Stop A Form from Closing

Posted on 1997-08-15
2
Medium Priority
?
177 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 80 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

770 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