unit uMain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, uForm2;
type
TMain =
class(TForm)
procedure FormCreate (Sender: TObject);
procedure NeuesFenster (Sender: TObject);
procedure F2Close (Sender: TObject);
procedure MainClose (Sender: TObject);
private
{ Private declarations }
bt1: TButton;
bt2: TButton;
F2: TFormular2;
btEnde: TButton;
public
{ Public declarations }
end;
var
Main: TMain;
implementation
{$R *.dfm}
procedure TMain.FormCreate(Sender: TObject);
begin
bt1:= TButton.Create(Main);
bt1.SetBounds(20,20,160,60);
bt1.Parent:= Main;
bt1.Caption:= '
Neues Fenster';
bt1.OnClick:= NeuesFenster;
btEnde:= TButton.Create(Main);
btEnde.SetBounds(20,100,160,60);
btEnde.Parent:= Main;
btEnde.Caption:= '
Schliessen';
btEnde.OnClick:= MainClose;
end;
procedure TMain.NeuesFenster(Sender:TObject);
begin
F2:=TFormular2.Create(Main);
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 TMain.F2Close(Sender: TObject);
begin
F2.Close;
bt1.enabled:=true;
end;
procedure TMain.MainClose(Sender: TObject);
begin
close;
end;
end.