/*
OnHide example
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. 
This is the implementation of Unit1:
*/
#include <vcl\vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include "Unit2.h"  // We must include unit2’s header file too!
//-------------------------------------------------------------
#pragma link "Grids"
#pragma resource "*.xdfm"
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";
}

/*
This is the implementation of Unit2:
*/
#include <vcl\vcl.h>
#pragma hdrstop

#include "Unit2.h"
#include "Unit1.h"  // We must include unit1’s header file too!
//-------------------------------------------------------------
#pragma link "Grids"
#pragma resource "*.xdfm"
TForm2 *Form2;
//-------------------------------------------------------------
#pragma resource "*.xdfm"
TForm2 *Form2;
//------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner): TForm(Owner)
{
}
//------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
  Form1->Show();
  Hide();
}
//------------------------------------------------------------------
void __fastcall TForm2::FormHide(TObject *Sender)
{
  Form1->Label1->Caption = "Form2 is hiding";
} 
