本人想实现一个功能:在主窗体中按下一个BUTTON,来打开一个MDI窗体。我的做法是:
主窗体FORM1(自动创建),放一个BUTTON,BUTTON代码:Form2:=TForm2.create(Application);Form2.show;
FORM2中FormStyle设置为:fsMDIform,onShow事件中代码:Form3:=TForm3.create(self);
FORM3中FormStyle设置为:fsMDIchild
运行程序出错:Project Project1.exe raised exception class EInvalidOperation with message'Cannot create form.No MDI forms are currently active.'Process stopped.Use Step or Run to continue.
请专家帮忙,程序应如何修改才能实现功能?盼复,感激不尽!
主窗体FORM1(自动创建),放一个BUTTON,BUTTON代码:Form2:=TForm2.create(Application);Form2.show;
FORM2中FormStyle设置为:fsMDIform,onShow事件中代码:Form3:=TForm3.create(self);
FORM3中FormStyle设置为:fsMDIchild
运行程序出错:Project Project1.exe raised exception class EInvalidOperation with message'Cannot create form.No MDI forms are currently active.'Process stopped.Use Step or Run to continue.
请专家帮忙,程序应如何修改才能实现功能?盼复,感激不尽!
Application.CreateForm(TForm2,Form2);
Application.CreateForm(TForm3,Form3);
MDIChild:=TMDIChild.Create(Application);
MDIChild.show;
//注意:在MDIParent单元中uses MDIChild单元。