{
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.
} 
procedure TForm1.PageControl1Changing(Sender: TObject; var AllowChange: Boolean);
begin
  if ((Sender as TPageControl).ActivePage = TabSheet1) then
    AllowChange := (Edit1.Text <> '')
  else
    AllowChange := True;
end;
 
