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

#include <vcl.h>
#pragma hdrstop

// BeginExample: TFormOnHide
// Event: Forms.TCustomForm.OnHide

// BeginCode
/*
This example uses two forms, each with a label and a button.
When the user clicks a button, the other form appears and
the current form disappears. Also, a message appears in the
label of the form that is showing, indicating that the other
form is hidden. Set the OnHide event handle for each form to
FormHide.This is the implementation section of Unit1:
*/
#include "TFormOnHide.h"
#include "Unit2.h"  // We must include unit2’s header file too!

#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  Form2->Show();
  Hide();
}

void __fastcall TForm1::FormHide(TObject *Sender)
{
  Form2->Label1->Caption = "Form1 is hiding";
}
// EndCode
// EndExample: TFormOnHide
//---------------------------------------------------------------------------

