//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "OnCloseQuery.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: OnCloseQuery
// Event: Forms.TCustomForm.OnCloseQuery

// BeginCode
/*
When the user attempts to close the form in this example, a
message dialog appears that asks the user if it is OK to
close the form. If the user chooses the OK button, the form
closes. If the user chooses Cancel, the form doesn't close.
Populate the OnCloseQuery event handler of the form.
*/
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
  if (MessageDlg("Close the form?", mtConfirmation, TMsgDlgButtons() << mbOK << mbCancel,0) == mrCancel)
    CanClose = false;
}
// EndCode
// EndExample: OnCloseQuery
//---------------------------------------------------------------------------
