Solved

Stop A Form from Closing

Posted on 1997-08-15
2
156 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
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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…

708 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

13 Experts available now in Live!

Get 1:1 Help Now