Installing a Single Source Delphi Component Into an Existing Package

Focused female engineer working at laptop in workshop

Hero Images/Getty Images

There are many free source Delphi components around the Internet you can install freely and use in your applications.

If you need to install a third-party Delphi component, and you only have the .PAS source file(s), follow this step-by-step tutorial and learn how to add the component into an existing package.

Note: This tutorial covers installing components in Delphi for Win32 (Delphi 7).

You'll learn how to install the TColorButton component.

of 06

Starting Delphi: Preparing to Install a New Component

delphi project start

Zarko Gajic 

First, start Delphi. A new project is created by default... Close it by pointing to File - Close All.

of 06

Delphi IDE Menu: Component - Install Component

install component delphi

Zarko Gajic 

Once the default new project is closed, select the "Install Component" menu item from the "Component" main Delphi IDE menu.

This will invoke the 'Install Component' dialog.

of 06

"Install Component" Dialog Box

delphi install component browse

 Zarko Gajic

With the "Install Component" dialog active, select the file with the component's source (?.PAS). Use the Browse button to select the unit, or enter the name of the unit you want to install in the "Unit File Name" edit box.

Note 1: If the unit's folder is in the Search Path, a full path name is not required. If the folder containing the unit file is not in the Search Path, it will be added to the end.

Note 2: The "Search Path" edit box displays the path used by Delphi to search for files. Leave this as it is.

of 06

Select Delphi Package for the Component

select delphi package

 Zarko Gajic

Use the "Package file name" drop-down list to select the name of an existing package. Note: all Delphi components are installed in the IDE as packages.

Note 1: The default package is "Borland User Components", there is no special need to alter this.

Note 2: The screenshot shows that the package "ADP_Components.dpk" is selected.

With the component's unit and package selected, hit the "OK" button on the "Install Component" dialog box.

of 06

Confirm Adding a New Component

confirm adding new component delphi

Zarko Gajic

With the component's unit and package selected, after you hit the "OK" button on the "Install Component" dialog box Delphi will prompt you whether you want to rebuild the modified package or not.

Click on "Yes"

After the package is compiled, Delphi will show you a message saying that the new TColorButton (or whatever the component name is) component was registered and already available as part of the VCL.

Close the package detail window, allowing Delphi to save the changes to it.

of 06

Using the Installed Component

using installed component delphi

Zarko Gajic

If all went well, the component is now available in the components palette.

Drop the component on a form, and simply: use it.

Note: if you have more units with components, just go back to Step 2: "Delphi IDE menu: Component - Install Component" and start from there.