Solved

Frame inheritance in Packages

Posted on 2006-06-13
4
560 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Printing problem 2 80
Show Listview image from database (String field) 5 113
oracle global variables 4 63
Working with hours 3 46
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

920 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

14 Experts available now in Live!

Get 1:1 Help Now