Solved

How do I trap the "X" button

Posted on 2008-10-30
4
176 Views
Last Modified: 2010-04-05
I want to prevent the user from closing the dialog form when clicking the X Button (in top right corner) if a certain criteria has not been met

procedure TfrmTrackList.FormCloseQuery(Sender: TObject;
  var CanClose: Boolean);
begin
 if Editing then
 begin
  ShowMessage('Can not close while editing.');
  CanClose:= False;
 end;
end;

However, this event never gets called when the "X" button is clicked

What do i have to do to accompish this

0
Comment
Question by:geocoins-software
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
SteveBay earned 250 total points
ID: 22842868
Hmmm, It looks right to me. Are you sure the event is assigned and that Editing is true?
0
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 22842898
My formCloseQuery event is fired when clicking the X button.
This should be standard.
0
 

Author Comment

by:geocoins-software
ID: 22842951
Thats what i thought. I get nothing.....  i will go double check some more
0
 

Author Comment

by:geocoins-software
ID: 22843013
Hah, my bad.....darn it, ive been at this too long. I added the darn event to the wrong dialog.

Ok, i guess the points should go to the first person who responed.

0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

18 Experts available now in Live!

Get 1:1 Help Now