Solved

Frame inheritance in Packages

Posted on 2006-06-13
4
559 Views
Last Modified: 2010-08-05
Hello,

I have a question about frame inheritance amoung multiple packages.

I have a generic frame (based on TFrame) that I like to use as a base frame throughout my software.  This frame simply has some very basic properties and events that I like to use for many of my frames.

Now the problem I am having is I have multiple packages that need access to this generic frame I have created.  I know that packages have a requirement that the base unit must be included inside the package itself.  There is also the requirement that the same unit cannot be in multiple packages.

So here is my question:  How can I make it so that I can use my generic frame amoung multiple packages without having to maintain multiple copies of the same generic frame (my current solution)?

I have tried using the repository but this does not seem to work (I realize of course that this could possibly be the answer and I havn't done it correctly).

Any help is appreciated.  Thanks.
0
Comment
Question by:charlesgates22
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:atul_parmar
ID: 16901053
There is also the requirement that the same unit cannot be in multiple packages.

I never heard so. you can use it in multiple package. can you tell me what prevents you to use it in multiple packages? or will you state how/what way you are using it?
0
 

Author Comment

by:charlesgates22
ID: 16903987
The same unit cannot be placed in multiple packages because it will be ambiguous to the compiler.  It won't know which one to use.

Basically I just want to use my frame for inheritance purposes.  It has some basic events/properties that I have standardized for different pieces of my software.
For example my software has things like Options, Printing selections, a list that allows users easy navigation within the software, etc.  But all these are in their own packages and are build off of my basic frame.  Since packages cannot all have my basic frame contained within them (it must be in the package in order to inherit from it) I am currently maintaining multiple copies of the same basic frame so that each package can have their own.  This was just a quick fix in order to complete what I was doing.  But I want to know how to do it correctly.

I know Borland has a vcl package that contains their common frame TFrame which can be inherited from in multiple packages without any problems.  I was hoping to find out if something similar can be done with my frame so that I can maintain one copy of my basic frame and have it available for other things as well.
0
 
LVL 10

Accepted Solution

by:
atul_parmar earned 250 total points
ID: 16909486
If I understand you correctly then the problem is that the same unit is already listed in different search path. If it is the case then.
1. Place that shared unit to a single fixed location
e.g.
C:\Packages\Shared\CommonUnit.pas
then use the same unit in multiple packages. e.g.
C:\C:\Packages\Package1 } Both are refers to the same CommonUnit.pas
C:\C:\Packages\Package2 }

To make this work make sure that the in the search path the location of CommonUnit.pas is  C:\Packages\Shared\CommonUnit.pas

I hope you will get what I mean else tell me the error message what Delphi shows when you try to add the shared unit to another package?
0
 

Author Comment

by:charlesgates22
ID: 16913937
atul_parmar, thanks for taking the time to answer my question.

You are correct and I am rewarding you the points.  You can have multiple packages reference the same unit without the packages complaining.

What I found out was I had a exe and some dll projects that were being built with packages that contained my basic frame.  That is when the compiler complained that multiple packages contained the same unit.  So what I did was modifiy my "Build with runtime packages" and removed some unnecessary packages that it was loading.  I also modified some of its
search paths to correctly reference some of the package units.  So now even though the exe and some of the dll's have to reference multiple packages that may contian my basic frame it won't complain and it runs correctly.

Thanks again.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now