我应该用多页面形式的delphi tframes吗? [英] Should I use delphi tframes for multi-pages forms?

查看:126
本文介绍了我应该用多页面形式的delphi tframes吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有一些表单具有不同的状态,这取决于用户正在做什么;例如,当通过他的文件列出表单时,该表单将在网格中显示有关该文件的一些数据,但是如果他点击某个按钮,则网格将被与之相关的图形替换。简单地说,形式的控件取决于用户想要做什么。



当然,显而易见的方法是根据需要显示/隐藏控件,工作像一个小数字的魅力,但一旦你达到10/15 +控制每个州(或超过3个状态真的)它是不可用的。



我正在尝试使用TFrames现在:我为每个状态创建一个框架,然后在我的表单上创建每个框架的一个实例,然后我只显示一个我想要使用Visible - 同时有一些控件在它的顶部,从任何框架,因为他们都分享他们。



这是正确的方式来做我想要的,还是我错过了一些东西?我以为我只能创建一个tframe实例,然后选择要显示的一个tframe实例,但是它看起来不是那样。



谢谢

解决方案

看起来像框架是这种情况的绝佳选择。我想补充一点,你可以使用基本框架和视觉继承来创建一个通用的界面。



第二部分:您设计一个像Form一样的框架,但是像Control那样使用它,极少的限制。请注意,您可以轻松地使用创建/自由而不是显示/隐藏。更好的是取决于资源如何。


I have some forms in my application which have different "states" depending on what the user is doing; for exemple when listing through his files the form displays some data about that file in a grid, but if he clicks on some button the grid is replaced by a graph relating to it. Simply said, the controls in the form depends on the what the user wants to do.

Of course the obvious way of doing that was showing/hidding controls as needed, works like a charm for small numbers but once you reach 10/15+ controls per state (or more than 3 states really) it's unusable.

I'm experimenting with TFrames right now: I create a frame for every state, I then create an instance of each frame on my form on top of each other and then I only display the one I want using Visible - while having some controls on top of it, out of any frame since they all share them.

Is this the right way to do what I want, or did I miss something along the way ? I thought I could create only one tframe instance and then chose which one to display in it but it doesn't look that way.

Thanks

解决方案

Looks like Frames are an excellent choice for this scenario. I'd like to add that you can use a Base Frame and Visual Inheritance to create a common interface.

And to the second part: You design a Frame like a Form but you use it like a Control, very few restrictions. Note that you could just as easily use Create/Free instead of Show/Hide. What is better depends on how resource-heavy they are.

这篇关于我应该用多页面形式的delphi tframes吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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