在Normal Form下创建MDIForm,并在MDIForm Error下打开一个MDI Child

发布于 2024-12-26 10:29:37 字数 361 浏览 4 评论 0原文

这是我的第一个主题

在同一个应用程序中:

我有一个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最舍不得你 2025-01-02 10:29:37

您不能像这样混合表单样式。 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.

烧了回忆取暖 2025-01-02 10:29:37

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 to FormStyle=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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文