RAD Studio VCL Reference
|
Occurs when the form is hidden (that is, when its Visible property is set to false).
property OnHide: TNotifyEvent;
__property TNotifyEvent OnHide;
Use OnHide to perform special processing when the form is hidden (that is, when the form's Visible property is set to false).
C++ Examples:
/* 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"; }
/* This is the implementation of Unit2: */ #include "Unit2.h" #include "TFormOnHide.h" // We must include unit1’s header file too! #pragma package(smart_init) #pragma resource "*.dfm" 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"; }
Delphi Examples:
{ 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;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|