J
jobsxy
Unregistered / Unconfirmed
GUEST, unregistred user!
原程序:
//菜单项一
procedure Tform1.menuclick1(Sender: TObject);
begin
defproc(TFrmAlarmInfo);
end;
//菜单项二
procedure Tform1.menuclick2(Sender: TObject);
begin
defproc(TFrmMove);
end;
....
//公共过程,用于判断此类实例是否已经运行,是则显示,否则创建
procedure TFr_MenuTree.defproc(MyForm:TFormclass);
var
i: integer;
abc: TForm;
begin
For i := 0 To application.ComponentCount-1 do begin
if Uppercase(application.Components.ClassName)=Uppercase(Myform.ClassName) then begin
TForm(MyForm).Show;
Exit;
end;
end;
abc := MyForm.Create(Application);
abc.ManualDock(Fr_main.Panel3,nil,alNone);
abc.show;
end;
现在的问题是,如果我判断这个类不存在,则创建并显示,这一步没问题,但如果判断有此类,那我如何让此类的实例SHOW出来呢?
//菜单项一
procedure Tform1.menuclick1(Sender: TObject);
begin
defproc(TFrmAlarmInfo);
end;
//菜单项二
procedure Tform1.menuclick2(Sender: TObject);
begin
defproc(TFrmMove);
end;
....
//公共过程,用于判断此类实例是否已经运行,是则显示,否则创建
procedure TFr_MenuTree.defproc(MyForm:TFormclass);
var
i: integer;
abc: TForm;
begin
For i := 0 To application.ComponentCount-1 do begin
if Uppercase(application.Components.ClassName)=Uppercase(Myform.ClassName) then begin
TForm(MyForm).Show;
Exit;
end;
end;
abc := MyForm.Create(Application);
abc.ManualDock(Fr_main.Panel3,nil,alNone);
abc.show;
end;
现在的问题是,如果我判断这个类不存在,则创建并显示,这一步没问题,但如果判断有此类,那我如何让此类的实例SHOW出来呢?