Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

How do I trap the "X" button

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
geocoins-software
Asked:
geocoins-software
  • 2
1 Solution
 
SteveBayCommented:
Hmmm, It looks right to me. Are you sure the event is assigned and that Editing is true?
0
 
mikelittlewoodCommented:
My formCloseQuery event is fired when clicking the X button.
This should be standard.
0
 
geocoins-softwareAuthor Commented:
Thats what i thought. I get nothing.....  i will go double check some more
0
 
geocoins-softwareAuthor Commented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now