VCL Component Installer

Download

Component menu with CompInstallOne of the things I missed most in Delphi 2005 was the VCL Component Install menu item in the Component menu. For reasons I still don’t quite understand, this expert was removed from the IDE. It was a quick way to install a component in the IDE, but since Delphi 2005, you had to manually create or open a package, manually add the component to it and then install it.

That is why I wrote this expert: it replaces the old Install Component expert under the Component menu. It allows you to pick a unit or units to install, to pick in which package it should go, and it opens the package and adds the units to it.

The wizard now also builds and installs the package. In a separate article, I describe how I did that.

Update: the wizard now also supports installing .dcu files, i.e. compiled units. These units must of course have been compiled with the same version of the compiler as your IDE uses.

Delphi and RAD Studio XE or newer

Those of you who have a copy of Delphi, C++Builder or RAD Studio XE, or newer, might have noticed it: This expert is now an integral part of the IDE. That is why I won’t be producing an XE version anymore.

Installation

The following assumes that $(BDS)\lib (where $(BDS) is your RAD Studio or Delphi base directory) is on your system path. If it isn’t, then either change the package output directory of the projects to one that is on the system path, or add lib to the System path. If you don’t do this, your IDE might not start or start but now show the main window, which makes it unusable. I had this problem and it took me a while to find out why packages would install properly, but after closing, the IDE would not start anymore.

In other words: Always make sure the .bpl files are on the system path!

Installation is quite simple, but not automatic. Extract the zip file to a directory of your choice. Start the IDE in which it is to be installed. Open the file CompInstallerDevelopment.groupproj or CompInstallerDevelopment.bdsgroup, depending on the Delphi version, from the subdirectory for your version of Delphi (e.g. D2007). In the Project manager, you should see three projects (the NNN is a number between 100 and 140):

  • CompInstallComponentsNNN.bpl — This contains a component that must be installed before you open the CompInstallNNN.bpl project.
  • CompInstallNNN.bpl — This is the actuall component installer.
  • CompInstallFrameEditProject.exe — This is a help project that makes editing the frames in the project a little easier.

First, activate the CompInstallComponentsNNN.bpl project, right click it and select Install from the context menu. This will install the package and register the TMRUComboBox component in the IDE.

Then you can activate the CompInstallNNN.bpl project. Installation of this package is done the same way as described before, from the context menu. If the project was installed successfully, under the menu Component there should be a new menu item Install VCL Component.

You can test the expert by installing the test components in the Common\TestComponents directory.

Unfortunately, I couldn’t test the code in Delphi 2005 yet. The expert will, for now, only install in Delphi 2006, 2007, 2009 or 2010. I will try to change this, but since there are some problems with the OpenTools API (OTA) in Delphi 2005 anyway, I don’t promise anything.

Usage

Usage is straightforward. Fill in the blanks, and at the end, press Finish to generate or open the package and add the units to it. Help is not available yet, but I doubt you will need it.

CompInstall unit selection page

CompInstall existing package page

CompInstall new package page

Editing

The project requires MRUCombos.pas, and that is why I also included CompInstallComponents.dpk. It should be installed in the IDE to be able to edit the frames and form.

CompInstall.dproj (or CompInstall.bdsproj) is a package project, and the IDE doesn’t treat this kind of project like it treats a normal .exe project. The package contains four frames, and packages and frames are not on good terms.

Each time you re-start the project, you might get an error message saying that one of the frames or the form can not be found or loaded, especially if the last time you loaded it, one of the frames, or the dialog using them, was selected. In such cases, just click Cancel, and do not click Ignore or Ignore All.

If you click Ignore or Ignore All, the frames will probably be removed from the dialog, and it is very tedious to get them back on again, make them align alClient, give them their proper names, and connect all the event handlers. If you click Cancel, you can’t edit the forms or frames which the IDE could not load anymore, but you can still edit the code and install the package.

To be able to edit the frames or forms in the package, you must first remove them from the package, and then add them again in the following order:

  • First add CompInstallUnitsFrames.pas. Open the file and select the designer. In the designer, right click the frame and choose "Add to Palette". In the dialog, click away any error messages you might get about the component already being installed, and just install the frame again.
  • Do the same for CompInstallPackagebase.pas, i.e. add it to the project and to the palette.
  • Now add CompInstallNewPackagesFrames.pas and CompInstallExistingPackageFrames.pas to the project and the palette.
  • Finally, add CompInstallWizardDlg.pas to the project. Now you can edit everything, but the next time you open the project, you might have to go through the same procedure again.

But normal .exe projects don’t have these problems. So I created an .exe project (a VCL Forms Win32 project) and added all the frames and units to it. In the Project Manager, this is shown as CompInstallFrameEditProject.exe, and is also in the .zip file. Simply add that project to your project group, and the problem should be gone.

C++Builder

The latest version of the wizard will also install components in the C++Builder personality. You can add Delphi units as well as C++Builder units. It creates a C++Builder package that contains the components and installs it.

C++Builder 2006

Unfortunately, I didn’t manage to make the Open Tools API of RAD Studio 2006 or C++Builder 2006 create a C++ package. I could create a package, but it did not look like one (no Contains or Requires sections, etc.) and it would not compile. You can of course create Delphi packages in RAD Studio 2006, but no C++ packages, using this wizard. If someone knows a way to make this happen, I’d love to hear about it.

The above problems did not occur in RAD Studio or C++Builder 2007 and above.

Legalese

I hope this code is useful to you. If you use some of it, please credit me. If you modify or improve the unit, please send me the modifications.

I may improve or enhance the unit myself, and I will try to post changes here. But this is not a promise. Please don’t request features.

Suggestions, remarks, flames, complaints, rewards, donations, etc. can be sent to my e-mail address.

Rudy Velthuis

Standard Disclaimer for External Links

These links are being provided as a convenience and for informational purposes only; they do not constitute an endorsement or an approval of any of the products, services or opinions of the corporation or organization or individual. I bear no responsibility for the accuracy, legality or content of the external site or for that of subsequent links. Contact the external site for answers to questions regarding its content.

Disclaimer and Copyright

The coding examples presented here are for illustration purposes only. The author takes no responsibility for end-user use. All content herein is copyrighted by Rudy Velthuis, and may not be reproduced in any form without the author's permission. Source code written by Rudy Velthuis presented as download is subject to the license in the files.

Back to top