Si me lo permite, expongo una variación.
Código Delphi
[-]unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TMDIChild = class(TForm)
Edit1: TEdit;
Label1: TLabel;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
public
constructor Create(AOwner: TComponent; AParametro:String);
end;
var
MDIChild: TMDIChild;
implementation
{$R *.dfm}
constructor TMDIChild.Create(AOwner: TComponent; AParametro:String);
begin
inherited Create(AOwner);
Edit1.Text := AParametro;
end;
procedure TMDIChild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
end.
Código Delphi
[-]
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TMDIForm = class(TForm)
Panel1: TPanel;
Button4: TButton;
Button3: TButton;
Button2: TButton;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
procedure CallMDIChild(const nro: Integer);
public
end;
var
MDIForm: TMDIForm;
implementation {$R *.dfm}
uses Unit2;
procedure TMDIForm.CallMDIChild(const nro: Integer);
begin
MDIChild := TMDIChild.Create(Self, IntToStr(nro));
end;
procedure TMDIForm.Button1Click(Sender: TObject);
begin
CallMDIChild(111);
end;
procedure TMDIForm.Button2Click(Sender: TObject);
begin
CallMDIChild(222);
end;
procedure TMDIForm.Button3Click(Sender: TObject);
begin
CallMDIChild(333);
end;
procedure TMDIForm.Button4Click(Sender: TObject);
begin
CallMDIChild(444);
end;
end.
Saludos cordiales