Solved

How do I trap the "X" button

Posted on 2008-10-30
4
178 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

810 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