unit TFormOnHide;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormHide(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

// 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:
}
 
implementation

{$R *.dfm}

uses Unit2;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2.Show;
  Hide;
end;

procedure TForm1.FormHide(Sender: TObject);
begin
  Form2.Label1.Caption := 'Form1 is hiding';
end;
// EndCode
// EndExample: TFormOnHide
end.
