Go Back   Wiki NewForum | Latest Entertainment News > Career Forum & Tips > Tech Forum & Tutorial > Oracle Database, SQL, Application, Programming


Say no to program closings!


Reply
Views: 1147  
Thread Tools Rate Thread
  #1  
Old 08-11-2010, 02:13 PM
bholas bholas is offline
Award Winner
 
Join Date: Apr 2010
Posts: 4,977
Default Say no to program closings!

Here's how to prompt users whether they really want to exit your program or not (regardless of how they choose to close it):
  1. Select your form (named "Form1" for example) and double click on its "OnCloseQuery" event
  2. Define the "FormCloseQuery" procedure as follows:

procedure TForm1.FormCloseQuery(
Sender: TObject;
var CanClose: Boolean);
begin
if(mrNo = MessageDlg(
'Are you sure you want to exit?',
mtInformation,
[mbYes, mbNo],
0)) then
begin
CanClose := False;
end;
end;

Reply With Quote
Reply

Tags
programming tips

New topics in Oracle Database, SQL, Application, Programming





Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
WikiNewForum)