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


Project's own components

Posted on 2004-10-23
Medium Priority
Last Modified: 2010-04-05

I have a project, say in directory MyProj. It uses some components, designed specifically for it. The source code for them is in dir MyProj/MyComponents.
How can I use these components in a project without adding them as a package to the system wide package list that delphi loads whenever it starts?

If i create a package for them and try to add it only to the project in project options window it is stll added to the global package list.
If i dont create package and only add directory "MyComponents" to the project's search path, delphi cannot load the form containing these components.
However in a latter case if i click ignore i can succesfully compile and run the project, the components of course are not beeing initizalized and AV occurs :(

Any ideas?
I'm using Delphi 6, although i could accept solution that works with some other version.

Question by:x-pander
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
  • 4
  • 2
LVL 12

Expert Comment

ID: 12389949
If you don't want to install the components, the only way to use them into the project is dynamically creation i.e.:
(Include into the uses clause Units containing the source code for them)

unit Unit1;


  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Buttons, SmallCalendar, ExtCtrls, ExExPanel;

  TForm1 = class(TForm)
    Button1: TSpeedButton;
    Button2: TSpeedButton;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    { Private declarations }
      ExExPanel1: TExExPanel;
      eCalendar1: TeCalendar;
    { Public declarations }

  Form1: TForm1;


{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
  ExExPanel1 := TExExPanel.Create(Self);
  ExExPanel1.Parent := Self;
  ExExPanel1.Top := 16;
  ExExPanel1.Left := 8;
  eCalendar1 := TeCalendar.Create(Self);
  eCalendar1.Parent := Self;
  eCalendar1.Top := 16;
  eCalendar1.Left := 128;

procedure TForm1.FormDestroy(Sender: TObject);

LVL 12

Accepted Solution

esoftbg earned 2000 total points
ID: 12392063
First: declare the components into the public section of the TForm

      ExExPanel1: TExExPanel;
      eCalendar1: TeCalendar;

Second: create dynamically the components, set the Parent, Top, Left .... properties at the FormCreate() event;

Last: free the components at the FormDestroy() event.

Author Comment

ID: 12392942
yea, that solution would work
i don't like it thouhg.
i lose all the advantages of using components - mainly being able to use object proprty editor to configure component at design time

so there is absolutely no way to make delphi register some components associated with the project in the moment of opening this project?
no delphi version is capable of doing that?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

LVL 12

Expert Comment

ID: 12395112
There is no way to install any components related only with a project. Installing components they appear into Delphi's IDE Component Palette and can be used with all the projects .... I am talking about Delphi up to version 7.
But what could be the reason to hide components between the projects ?

Author Comment

ID: 12404834
well, i'm working on projects that uses different version of the same components, so each time i switch to different proj i have to deinstall one set and install the other set of compomnents, have to remember about removing relevant *.bpl and *.dcu files from somwhere, it's just quite anoying...
but well it seems i either have to live with it or create the components dynamically
anyway, thanks for claryifing that
LVL 12

Expert Comment

ID: 12406125
1). Working solution if you have free disk space enough (large physical HDD or HDD's). You may split for example a 80 GB HDD in 4 partitions 20 GB each .... Then install operational system for every of them, then Delphi for every of them and different components for every independent instance of Delphi .... This way you will work with different projects only after restart the computer and select the operational system where is the project you want to work with .... This works 100 %. I am working this way ....
2). Possible solution if you create multi user installation of Delphi (Installations under different Windows user-names) .... I am not sure it will work, it depends on how is stored the information into the Windows Registry: is it independent for every user (without conflict) or not ????

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

636 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