在 SDI 和 MDI 之间切换 GUI 应用程序行为
我目前有一个使用 Delphi 7 构建的 SDI 应用程序,我希望最终用户在运行时选择 SDI 和 MDI 之间的接口类型。我的问题是如何在运行时更改 SDI 和 MDI 之间的应用程序行为?
目前我知道有几个使用 delphi 构建的应用程序允许这样做: EMS SQL Manager 和TOAD。
提前致谢。
I currently have an SDI application that is build with Delphi 7, I want the final user to choose the type of interface between SDI and MDI at runtime. my question is how can I change the behavior of the application between SDI and MDI at runtime?
Currently I know a couple of applications build with delphi that allow this: EMS SQL Manager and TOAD.
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
下载 Jedi JVCL 并安装它,然后查看 JvDocking“对接代码”的演示。他们正是这样做的。
它们意味着您实际上不会使用 FormStyle=fsMDIChild ,除非您想要出现很多问题。当您需要时,通过对接代码来“模拟”MDI。
不要将窗口转换为框架。这是一个糟糕的解决方案。
对于不存在 MDI 问题的类似 MDI 的环境,请使用对接解决方案(支持对接的商业或开源组件)。我使用 JvDocking,它包含在 JEDI JVCL 中,它是免费且开源的。
您可以在“停靠”和“非停靠”(浮动)模式下使用表单,这将为您提供停靠的 IDE 外观(VIsual Studio 和 RAD Studio)以及非停靠 IDE 外观(非停靠的 RAD Studio 或经典德尔福7)。
Download the Jedi JVCL and install it and look at the Demos for JvDocking "docking in code". They do this exactly.
They mean that you do not actually use the FormStyle=fsMDIChild unless you want lots of problems. MDI is "emulated" when you need it by docking in code.
Do not convert windows into frames. This is a bad solution.
For an MDI-like environment, that does not have the MDI problems, use a docking solution (components either commercial or open source that support docking). I use JvDocking which is included in the JEDI JVCL, which is free and open source.
You use your forms in both "docked" and "undocked" (floating) modes, and this gives you a docked IDE look and feel (VIsual Studio and RAD Studio), and an undocked IDE Look and feel (RAD Studio in undocked, or classic delphi 7).
我会将当前的窗口转换为框架,并将这些带有align=alClient 的框架放入配置的mdi 子窗口或普通窗口中。
但要注意:我从未真正这样做过,所以可能存在我不知道的问题。
I would convert my current windows into frames and put these frames with align=alClient into either mdi child windows or normal windows as configured.
But beware: I have never actually done this, so there might be problems that I don't know about.
在运行时,根据您需要 SDI 还是 MDI,将 TForm.FormStyle 设置为 fsNormal 或 fsMDIChild。
At runtime set TForm.FormStyle either to fsNormal or fsMDIChild depending on if you want SDI or MDI.
就像@WarrenP 的解决方案一样,我强烈推荐基于对接的解决方案。应该说,你不需要使用Jedi VCL来实现这一点。举个例子,这里是一个非常简单的(all-native-vcl)组件我们已经制作了它,允许您简单地将尽可能多的实例拖放到表单中,并设置它们的对齐方式以在这些区域中启用停靠(和选项卡式停靠)。
MDI本身就是一场等待发生的事故。有一些解决方案可以在不使用 MDI 本身的情况下实现“MDI 外观和感觉”,尽管我还没有遇到一个我认为“简洁”的解决方案(可能是因为缺乏外观)。
最终,您可能应该质疑提供 MDI 作为选项是否明智。对接(无论是否具有取消对接的能力,尤其是当选项卡式对接是用户确定的选择时)感觉更现代,并且(正确完成)可以比 MDI 更加灵活和直观。
只值我的2便士。
Like @WarrenP's solution, I strongly recommend a docking-based solution. It should be said that you don't need to use Jedi VCL to achieve this. As an example, here's a very simple (all-native-vcl) component I've produced which allows you to simply drop on as many instances to your form(s) and set their alignment to enable docking (and tabbed docking) in those regions.
MDI itself is an accident waiting for a place to happen. There are solutions available to achieve the "MDI look and feel" without using MDI itself, though I've yet to encounter one I'd consider "neat" (probably for a lack of looking).
Ultimately you should probably question the wisdom in providing MDI as an option. Docking (with or without the ability to undock, and especially when Tabbed Docking is a user-determined choice) feels more modern, and (done properly) can be far more flexible and intuitive than MDI ever was.
Just my 2-pence worth.