Frame inheritance and duplicate files in packages
Asked Answered
C

1

2

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.

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:

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).

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.

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.

Cm answered 24/6, 2009 at 18:2 Comment(0)
J
3

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

Jamnis answered 24/6, 2009 at 18:16 Comment(2)
Though I thought I'd tried an approach very similar to this yesterday, today it seems to do the trick. Thanks for the post, and I'll update the original question if I find another "quirk" in the TFrame-to-component process because of this. Thanks again.Cm
Update: This fixes the compiling problem of needing the file, but not the form-loading-at-designtime problem. HOWEVER, one can load the TBaseFrame file manually (I did via Ctrl-Click), NOT as part of the package/project, and then close/re-open the descendant TFrame, and it will load visually in the IDE OK then.Cm

© 2022 - 2024 — McMap. All rights reserved.