Installing TMS components with shared units
Several TMS Components share units. Two such examples are: ADVSTYLEIF.PAS and ADVGDIP.PAS. These units define commonly used functionality, classes, constants etc.. It is a known limitation of the Delphi packages architecture that for installed packages in the IDE, a unit can only be present in one package. As such, it is problematic to install two or more packages that use the same unit(s). It is not desirable at all from our development perspective and not from a deployment perspective to duplicate the code in units with different names. Not only causes this issues when common constants, classes need to be used, but duplicating code is never a good idea. When multiple packages were purchased that have shared units, fortunatily as we deliver all products with full source code, it is straightforward to overcome this.
When purchasing product bundles like TMS Compononent Pack this problem also does not occur. TMS VCL UI Pack packages are designed & optimized to allow to use all components simultanously. Although it is more convenient to install & use a product like TMS Compononent Pack we did not want to remove the flexibility & freedom of customers to choose just some specific components instead of a bundle.
Step by step solution guide
- Create a new folder
- Move the shared unit(s) from the different product folders to the new folder (for example ADVSTYLEIF.PAS, ADVGDIP.PAS, ...)
- Open the package files of the different products and remove references to the shared unit(s) (for example ADVSTYLEIF.PAS, ADVGDIP.PAS, ...)
- In the new folder, create a new package file : TMSCOMMON.DPK
- Add the shared units to this new package file and compile & install this package TMSCOMMON.DPK.
- Open the package files of the different products and in the Requires list of the package, add a reference to TMSCOMMON.DCP
- Compile & install the packages of the different products
Example to illustrate the process
When trying to install TAdvStringGrid and THTMListBox simultanously, the IDE will complain about shared units ADVSTYLEIF.PAS and ADVGRADIENT.PAS. To install both components simultanously in Delphi 2010 we perform following steps:
1) Create new folder C:\Users\UserName\tmssoftware\TMSCommon, further referred to as ($CMN).
2) Move the files ADVSTYLEIF.PAS & ADVGRADIENT.PAS from the TAdvStringGrid folder to this ($CMN) folder.
3) Delete the files ADVSTYLEIF.PAS & ADVGRADIENT.PAS in the THTMListBox install folder.
4) From Delphi 2010, choose File, New, Other, Delphi Projects, Package
5) Save the package as TMSCOMMON.DPROJ in the folder ($CMN)
6) Add the files ADVSTYLEIF.PAS & ADVGRADIENT.PAS to the package TMSCOMMON.DPROJ
7) Compile & install the package TMSCOMMON.DPROJ
8) Open the TAdvStringGrid package ASGD2010.DPROJ and from the "Contains" section, remove ADVSTYLEIF.PAS & ADVGRADIENT.PAS
9) In the TAdvStringGrid package ASGD2010.DPROJ, click on "Requires" and browse for/add the file TMSCOMMON.DCP
10) Compile & install the TAdvStringGrid package ASGD2010.DPROJ
11) Open the THTMListBox package HTMLISTBOXPKGD2010.DPROJ and from the "Contains" section, remove ADVSTYLEIF.PAS & ADVGRADIENT.PAS
12) In the THTMListBox package HTMLISTBOXPKGD2010.DPROJ click on "Requires" and browse for/add the file TMSCOMMON.DCP
13) Compile & install the THTMListBox HTMLISTBOXPKGD2010.DPROJ package
Both components will now be installed.
Installing trial and registered version with shared units
When using a trial version, due to the binary compatibility checks the compiler performs, this cannot be simultaneously installed with a full source code package. This is due to shared units that are on one side compiled here for the trial version distribution and are compiled on your machine. For evaluation purposes, you'd need to temporarily disable the full source code package and install the trial version. When you use full source code based latest versions of both products, then all files can be compiled on your machine and simultaneous install is possible.