to beta:
但是你昨天回答的TForm(Application.FindComponent(s)).show倒是可以。
///// unit TempletForm 是具有XP风格的窗体模板,U_MyForm是作为动态产生其他模板
unit TempletForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Menus, ComCtrls, ToolWin, Buttons, StdCtrls, AppEvnts,
LabelButton, TradeImage, MaskImageButton, MoveImageButton;
type
TModelFrom = class(TForm)
unit U_MyForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TEMPLETFORM, ComCtrls, Menus, ToolWin, StdCtrls, ExtCtrls,
Buttons;
type
TMyForm = class(TModelForm)
public
procedure SetData();
/////另一窗体执行事件
procedure TMainForm.Button1Click(Sender: TObject);
var
s:string;
begin
inherited;
s:='MyForm_1';
//TForm(Application.FindComponent(s)).Show ;//该条正确执行
TForm(Application.FindComponent(s)).SetData();//编译:Undeclared identifier
end;