先是在一个普通form里创建一个fsMDIForm类型窗口并显示,
frmSystemMgr:=TfrmSystemMgr.Create(Application);
frmSystemMgr.ShowModal;
然后在该新键的FORM里创建一个fsMDIChild类型的子窗口,但出错!
if Application.FindComponent('frmDeptMgr')=nil then
begin
frmDeptMgr:=TfrmDeptMgr.Create(Self); //出错!!!!!
end;
frmDeptMgr.Show;
出错信息是“无法创建窗口,目前没有活动的MDI窗口.”
frmSystemMgr:=TfrmSystemMgr.Create(Application);
frmSystemMgr.ShowModal;
然后在该新键的FORM里创建一个fsMDIChild类型的子窗口,但出错!
if Application.FindComponent('frmDeptMgr')=nil then
begin
frmDeptMgr:=TfrmDeptMgr.Create(Self); //出错!!!!!
end;
frmDeptMgr.Show;
出错信息是“无法创建窗口,目前没有活动的MDI窗口.”
frmDeptMgr:=TfrmDeptMgr.Create(frmSystemMgr);
var
frmDeptMgr:TfrmDeptMgr;
建个窗体, formstyle 设为fsmdiform或fsmdichile
把你的主窗体的formstyle:=fsmdiform;
子窗体创建时,因为你的父窗体是手动创建的,所以子窗体才会说找不到父窗体!