Solved

Frame inheritance in Packages

Posted on 2006-06-13
4
564 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 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