unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls;
type
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
procedure NeuesFenster(Sender:TObject);
procedure F2Close(Sender: TObject);
procedure FC(Sender: TObject);
private
{ Private-Deklarationen }
bt1: TButton;
bt2: TButton;
F2: TForm;
btEnde: TButton;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FC(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
bt1:= TButton.Create(Self);
bt1.SetBounds(20,20,160,60);
bt1.Parent:= Self;
bt1.Caption:= '
Neues Fenster';
bt1.OnClick:= NeuesFenster;
btEnde:= TButton.Create(Self);
btEnde.SetBounds(20,100,160,60);
btEnde.Parent:= Self;
btEnde.Caption:= '
Schliessen';
btEnde.OnClick:= FC;
end;
procedure TForm1.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;
end;
procedure TForm1.F2Close(Sender: TObject);
begin
F2.Close;
bt1.enabled:=true;
end;
end.