/*
OnChanging example
This project requires a TPageControl, several TTabSheets (to add sheets, right click the Page Control and select New Page from the context menu), and a TEdit control on the first tab sheet.  
The user is not allowed to change to a new page if the active page is TabSheet1 and there is no text in the Edit Control.
*/ 
void __fastcall TForm1::PageControl1Changing(TObject *Sender, bool &AllowChange)
{
  if (((TPageControl *)Sender)->ActivePage == TabSheet1)
    AllowChange = (!Edit1->Text.IsEmpty());
  else
    AllowChange = true;
  if (AllowChange == false)
  {
    MessageBeep(0);
    Edit1->SetFocus();
  }
}
 
