MDI接口与FireMonkey [英] MDI interface with FireMonkey

查看:171
本文介绍了MDI接口与FireMonkey的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以使用FireMonkey创建一个传统意义上的许多文档格式/框架和一个主窗体的MDI应用程序?



我特意感兴趣,因为那里在表单上没有MDI控件已经被替换了不同的东西?



编辑:添加到这个问题,当我创建子表单时,它们都在任务栏中单独显示,甚至OpenDialogs ..

解决方案

这是一种可以使用的方法:



1)正常创建您的个人表单,除了使用TLayout,将其称为LayoutMain,(对齐alClient)作为该表单上所有控件的父级。



2)在主窗体中,当要将表单实例带入MDI接口时,创建一个TLayout(称为FormContainer或某些东西),作为一个小孩对齐到顶部)另一个TLayout(称为FormHeader),其中包含表单标题的各个控件,最小化/最大化/关闭按钮以及您在框架标题上的任何其他内容。 表单(但不显示),然后将该实例的主要TLayoutLayoutMain的父级添加到主窗体的TLayoutFormContainer。



4)在之前提到的TLayout(名称为FormHeader)中,给出 OnMouseDown OnMouseMove 事件提供在主窗体中拖动它的能力。



当您想最大化主窗体中的子窗体时,您只需设置外部TLayoutFormContainer对齐属性到alClient,记住在表单的实例中存储其原始的Top,Left,Width和Height值,以便您可以在按还原按钮时调用它们。



这是一个相当涉及的解决方案,但是据我所知,这是唯一的方法,你将要实现您正在尝试使用FireMonkey,因为它存在今天(大约更新2



我不会指望Embarcadero提供任何形式的MDI模拟作为FireMonkey的一部分开箱即用,因为MDI被认为是一种老式的方法。



更为现代的解决方案是使用Docking,就像RAD Studio IDE本身一样。这提供了两个世界中最好的,给用户自由选择他们想要链接到主表单中的孩子形式,或者自己显示在自己的外部(或任何停靠安排的组合)。


Is it possible to create an MDI application using FireMonkey in a traditional sense of many documents forms/frames and one master form?

I'm specifically interested since there are no MDI controls on forms anymore.. Has it been replaced with something different?

EDIT: Adding to the question, when I create child forms they all showed separately in taskbar, even the OpenDialogs..

解决方案

Here's one approach you can use:

1) Create your individual forms as normal, except use a TLayout, call it "LayoutMain", (aligned alClient) as the parent of all controls on that form.

2) On your "master form", when you want to bring a form instance in to behave as it would as an MDI interface, create a TLayout (call it "FormContainer" or something), place as a child of that (aligned to top) another TLayout (call it "FormHeader"), containing the individual controls for the Form Caption, the Minimize/Maximize/Close buttons and anything else you'd like on the "frame" heading. This is called a Composite.

3) Create an instance of your child form (but don't show it), then parent that instance's primary TLayout "LayoutMain" to your main form's TLayout "FormContainer".

4) On the TLayout previously mentioned (with the name "FormHeader"), give it OnMouseDown and OnMouseMove events to provide the ability to drag it around the Master Form.

When you want to maximize the child form inside the master form, you'd just set the outer TLayout "FormContainer" align property to alClient, remembering to store its original Top, Left, Width and Height values within the the form's instance so you can recall them when pressing the Restore button.

True, this is a fairly involved solution, but to the very best of my knowledge this is the only way you're going to achieve what you're trying to do with FireMonkey as it exists today (circa Update 2).

I wouldn't expect Embarcadero to provide any form of MDI emulation as part of FireMonkey "out of the box", as MDI is considered an old-fashioned approach.

The more modern solution would be to use Docking, as the RAD Studio IDE itself does. This provides the very best of both worlds, giving the user the freedom to choose what child forms they want to link into the master form, or display outside of that on their own (or any combination of docked arrangements).

这篇关于MDI接口与FireMonkey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆