Solved

How do I trap the "X" button

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

830 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