unit Main;

interface

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

type
  TForm2 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    RichEdit1: TRichEdit;
    TabSheet2: TTabSheet;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    TabSheet3: TTabSheet;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    procedure PageControl1Change(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.BitBtn1Click(Sender: TObject);
begin
	Close();
end;

procedure TForm2.PageControl1Change(Sender: TObject);
var
	idx      : Integer;
   sCaption : String;

begin
   idx      := PageControl1.TabIndex;
   sCaption := PageControl1.Pages[idx].Caption;

   ShowMessage('Zakładka nr ' + IntToStr(idx) + #10#13 + sCaption);
end;

end.

