Hola.
Si entendí bien, un modo sería:
MDIChild:
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;
const
WM_AFTER_SHOW = WM_USER + 301;
type
TMDIChild = class(TForm)
Edit1: TEdit;
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
FParametro: string;
procedure WmAfterShow(var Msg: TMessage); message WM_AFTER_SHOW;
public
property Parametro: string read FParametro write FParametro;
end;
var
MDIChild: TMDIChild;
implementation {$R *.dfm}
procedure TMDIChild.FormShow(Sender: TObject);
begin
PostMessage(Self.Handle, WM_AFTER_SHOW, 0, 0);
end;
procedure TMDIChild.WmAfterShow(var Msg: TMessage);
begin
Edit1.Text := Parametro;
end;
procedure TMDIChild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
end;
end.
MDIForm:
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);
MDIChild.Parametro := 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.
Salida del ejemplo:
Saludos
