Installing a single source Delphi component into an existing Package

01
of 06

Starting Delphi. Preparing to install a new component

There are many free source Delphi components arround 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 1: this tutorial covers installing components in Delphi for Win32 (Delphi 7).

You'll learn how to install the TColorButton component.

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

02
of 06

Delphi IDE menu: Component - Install Component

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.

03
of 06

"Install Component" dialog box

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.

04
of 06

Select Delphi Package for the component

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 screen shot 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.

05
of 06

Confirm adding a new component

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.

06
of 06

Using the installed component

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.