Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Frame inheritance in Packages

Posted on 2006-06-13
4
Medium Priority
?
566 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 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

610 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