Sunday, September 22, 2013

Formstyle: fsMDIForm, fsMDIChild

Button show in Form1
procedure TForm1.BshowClick(Sender: TObject);
begin
if form2 = nil then
 begin
  Form2 := TForm2.Create(Application);
  exit;
 end else;
  Form2.BringToFront;
end;

Button close in form1
procedure TForm1.BcloseClick(Sender: TObject);
begin
Form2.Close;
end;

Onclose in form2
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;

Ondistroy in form2
procedure TForm2.FormDestroy(Sender: TObject);
begin
Form2:= nil;
end;

No comments:

Post a Comment