unit Main;

interface

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

type
  TMainForm = class(TForm)
    Panel1: TPanel;
    btnCLOSE: TBitBtn;
    btnSTART: TBitBtn;
    procedure btnSTARTClick(Sender: TObject);
    procedure btnCLOSEClick(Sender: TObject);
  private

  public
	 procedure Pokaz_okno();
  end;

var
  MainForm: TMainForm;

implementation

uses Unit2;

{$R *.dfm}

procedure TMainForm.btnCLOSEClick(Sender: TObject);
begin
	Close();
end;

procedure TMainForm.btnSTARTClick(Sender: TObject);
begin
	Pokaz_okno();
end;

procedure TMainForm.Pokaz_okno();
begin
   // tworzymy okno niemodalne
   // jeżeli nie ma jeszcze swojej instancji
   if not Assigned(Form2) then
   begin
      Form2 := TForm2(Application);
      Form2.Show();
   end
   else begin
      Form2.Show();
   end;
end;

end.

