Guide how to install component packages in Delphi 2005 (or...

Transcription

Guide how to install component packages in Delphi 2005 (or...
Guide how to install component packages in Delphi 2005 (or newer version)
In Delphi 2005 custom components are installed in the IDE as packages (BPL files).
If you need to install a third-party (or your own) Delphi component, and you only have the .PAS source file(s),
follow this step-by-step tutorial and learn how to create a package to host your components.
To begin, start Delphi 2005 ...
From the main IDE menu, select "File" - "New" - "Package - Delphi for Win32"
Point to "File" - "Save All" to save the project. Even though you can do this later, we'll first save the project to
the give name to the package and create a folder to store the component units this package will hold.
In the "Save Package1 As" dialog box, navigate to (assuming this is where you have installed Delphi 2005)
"C:\Program Files\Borland\BDS\3.0". Create a new folder here, named for example "ADPVCL". Save the package
for example with the name : "ADPVCL90.bdsproj".
Once you save the project, move the component unit(s) to the newly created folder.
Before we actually add the components to the package, we'll first set some properties. Select "Project" "Options" using the IDE main menu.
Once the "Project Options for ADPVCL90.bpl" dialog appears, select the "Description" item and enter for
example "About Delphi Programming VCL 90" in the description edit box.
With the "Project Options for ADPVCL90.bpl" dialog box still active, select the "Directories/Conditionals" item.
Enter "C:\Program Files\Borland\BDS\3.0\ADPVCL" in the "Output Directory" edit box. This is where the
compiled packages will be saved.
Note: if you leave "Output Directory" empty, the compiled package (BPL) wil be saved to "\My
Documents\Borland Studio Projects\Bpl".
Hit the "OK" button to close the Options dialog.
When we have "prepared" the package, we can proceed to adding our custom components to it.
Select "Project" - "Add to Project" from the main IDE menu. This will activate the "Add" dialog.
The "Add unit" tab in the "Add" dialog box lets us choose the unit to be included in the package.
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.
The "Unit file name" dialogs lets you pick the component(s) source file to be included in the package. Point to
the folder with the units and add as many units as you have.
Note: We have moved all the units (?.PAS) to the folder where the package project is saved.
Finally, we are ready to build the package. Select "Project" - "Build ADPVCL90" menu item. This will start the
build process and will create a compiled package "ADPVCL.BPL".
You are now ready to actually install the components (package) to the IDE for the components to appear on the
Tool Palette.
To begin, start Delphi 2005 ... then point to "Component" - "Install Packages" IDE menu item.
A list of available packages appears in the Design packages list box. To add a package to the list, click the "Add"
button.
Note:
To uninstall a package, uncheck its check box.
To remove a package from the list, select the package and click Remove
Browse the "Add Design Package" dialog for the directory where the .bpl file resides.
Select the "ADPVCL90.BPL" package we've created before.
The selected package appears in the Design packages list box - and is ready to be used in applications.
To see a list of components included in an installed package, select the package and click Components.
To test the components from the installed package, create a new Win32 VCL application.
Activate the Tool Palette window, pick the component you are interested in, dropit on the form. Use it...
THE END J