Solved

How do I trap the "X" button

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

22 Experts available now in Live!

Get 1:1 Help Now