包中的框架继承和重复文件 [英] Frame inheritance and duplicate files in packages

查看:12
本文介绍了包中的框架继承和重复文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 TFrame 和 ModelMaker 开发许多组件——我发现视觉设计/开发 + 继承 + ModelMaker 的组合非常引人注目.然后我注册这些带有注册单元的 TFrame 后代,它们从那里成为成熟的基于调色板的组件.我正在使用 Delphi 2007.

I have been developing a number of components using TFrames and ModelMaker -- I've found the combination of visual design/development + inheritance + ModelMaker to be very compelling. I then register these TFrame descendants w/a registration unit, and they become full-fledges palette-based components from there. I'm using Delphi 2007.

在我了解这个过程的小障碍"的早期,我发现 TFrame 后代流错误(通常在 IDE 中显示为表单,而不是帧)可能会遇到一些问题,这可能完全是通过引入我自己的TBaseFrame"类来消除,该类继承自 TFrame 而没有更改,然后使用 THAT 作为基类来开发组件(添加方法、属性等).如果我将属性和方法等添加到直接从 TFrame 继承的类/框架中,dfm 文件流式传输经常会混淆.

Early in my learning about the little "snags" of this process, I found that a number of the problems I would run into with TFrame descendants streaming incorrectly (often appearing as forms in the IDE, rather than frames) could be completely eliminated by introducing my own "TBaseFrame" class which inherits from TFrame with no chanegs, and then use THAT as the base class to develop components from (adding methods, properties, etc). If I added properties and methods, etc. to a class/frame inheriting directly from TFrame, the dfm file streaming would often get confused.

所以,一旦我解决了问题,总体来说效果很好.

So, overall it's worked great, once I got the kinks worked out.

不过,昨天我遇到了一个新问题:

Yesterday, though, I ran into a new problem:

我将生成的组件安装在包集中,并以有意义的方式进行分组(即,应用 1 的所有面板"都在一个包中,应用 2 的许多查看器"在另一个包中,等等).

I install the resulting components in package sets, grouped in ways that make sense (i.e. all of the "panels" for App 1 are in one package, a number of "viewers" for App 2 are in another, etc).

如果包中不包含 TBaseFrame 类,则继承的 TFrame-descendant 组件将不会加载到 IDE 中.但是,如果我将 TBaseFrame 添加到包中,当它在多个包中具有相同的源 PAS 文件时,我会遇到 Delphi 报告的冲突.

If the TBaseFrame class is not included in the package, the inheriting TFrame-descendant component will not load in the IDE. BUT, if I add TBaseFrame to the package, I run into the conflict Delphi reports when it has the same source PAS file in more than one package.

可以将我的所有基于 frame=的组件放入一个巨大的包中,但我真的非常不愿意这样做,因为我可以清楚地看到它会变得太大/失控随着时间的推移,考虑到我计划开发多少套的性质.有没有其他方法可以解决这个冲突?

I could put ALL of my frame=based components into one giant package, but I'd really, really prefer not to, as I can clearly see that will get too large / out of hand over time, given the nature of how many sets I plan on developing. Is there any other way to resolve this conflict?

更新——有一个技巧可以让它正常"工作——一定要阅读下面的评论.

Update -- there is a trick to getting this to work "properly" -- be sure to read the comments below.

推荐答案

您是否尝试将您的 TBaseFrame 放在一个单独的包中,而所有其他包都需要"该包?

Have you tried to put your TBaseFrame in one separate package that would be "required" by all other packages?

这篇关于包中的框架继承和重复文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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