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

#include <vcl.h>
#pragma hdrstop

#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: TFormOnClose
// Event: Forms.TCustomForm.OnClose

// BeginCode
/*
This example displays a message dialog box when the user
attempts to close the form. If the user clicks the Yes
button, the form closes; otherwise, the form only minimizes.
TCustomForm.Close does not allow an action of caMinimize
for a form closing itself.  Close Form2 from Form1 (from
a button?) and implement the OnClose in Form2.  Place
"Application.CreateForm(TForm2, Form2);" in the project dpr
file to open Form2 and set the Form2 Visible property to
True.
*/
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
  if (MessageDlg("Close application ?", mtConfirmation, TMsgDlgButtons() << mbYes << mbNo,0) == mrYes)
    Action = caFree;
  else
    Action = caMinimize;
}
// EndCode
// EndExample: TFormOnClose
//---------------------------------------------------------------------------
