unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMain =
class(TForm)
procedure FormCreate(Sender: TObject);
procedure NeuesFenster (Sender: TObject);
procedure F2Close (Sender: TObject);
procedure MainClose (Sender: TObject);
private
{ Private-Deklarationen }
bt1: TButton;
bt2: TButton;
F2: TForm;
btEnde: TButton;
public
{ Public-Deklarationen }
end;
var
Main: TMain;
implementation
{$R *.dfm}
procedure TMain.F2Close(Sender: TObject);
begin
F2.Close;
bt1.enabled:=true;
end;
procedure TMain.FormCreate(Sender: TObject);
begin
bt1:= TButton.Create(self);
bt1.SetBounds(20,20,160,60);
bt1.Parent:= self;
bt1.Caption:= '
Neues Fenster';
bt1.OnClick := NeuesFenster;
bt1.Visible := True;
btEnde:= TButton.Create(self);
btEnde.SetBounds(20,100,160,60);
btEnde.Parent:= self;
btEnde.Caption:= '
Schliessen';
btEnde.OnClick:= MainClose;
btEnde.Visible := true;
end;
procedure TMain.MainClose(Sender: TObject);
begin
close;
end;
procedure TMain.NeuesFenster(Sender: TObject);
begin
F2 := TForm.Create(self);
F2.Show;
bt2:= TButton.Create(F2);
bt2.SetBounds(20,20,160,100);
bt2.Parent:= F2;
bt2.Caption:= '
Formular schließen';
bt2.OnClick:= F2Close;
bt1.enabled:=false;
bt2.Visible := true;
end;
end.