在Normal Form下创建MDIForm,并在MDIForm Error下打开一个MDI Child
这是我的第一个主题
在同一个应用程序中:
我有一个NormalForm(Mainform),在Popupmenu调用的MDIForm中如下所示:
MDIForm:=TMDIForm.Create(nil);
MDIForm.Show;
表单正确打开...现在,在MDI表单中我尝试创建MDIChild:
fm := TMDIChild.Create(Self);
fm.FormStyle:=fsMDIChild;
fm.Show;
检索错误: 无法创建表单。当前没有活动的 MDI 表单
有人知道怎么做吗?!
This is my first topic
In the same application:
I Have a NormalForm (Mainform), that in a Popupmenu call's MDIForm like this:
MDIForm:=TMDIForm.Create(nil);
MDIForm.Show;
The forms open correctly... Now, in the MDI form i try to create MDIChild with:
fm := TMDIChild.Create(Self);
fm.FormStyle:=fsMDIChild;
fm.Show;
Retrieve the error:
Cannot Create Form. No MDI Forms are currently active
Anyone knows how do that?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不能像这样混合表单样式。 MDI 子窗体期望应用程序的主窗体是 MDI 窗体。 VCL 的代码不会查看创建子级时是否有任何可用的 MDI 表单。
You can't mix form styles like that. An MDI child form expects the main form of the application to be an MDI form. The VCL's code does not look to see if any MDI forms are available when the child is created.
VCL 本身并不支持您正在尝试的操作。它要求将应用的
MainForm
设置为FormStyle=fsMDIForm
,并且它仅查看 MainForm。您的 MainForm 不是这样设置的。这是 VCL 限制,而不是 Windows 限制。可以解决这个问题并在其他非 MainForm 窗体中使用 MDI 子窗体,但这需要对 VCL 源代码进行大量修改。请参阅此示例和此质量控制报告。
The VCL does not natively support what you are attempting. It requires the app's
MainForm
to be set toFormStyle=fsMDIForm
, and it only looks at the MainForm. Your MainForm is not set up that way.This is a VCL limitation, not a Windows limitation. It is possible to work around this and use MDI child forms in other non-MainForm forms, but it requires quite a bit of hacking of the VCL's source code. See this example and this QC report.