Adding a Wizard or Component to a Package


  Now the Wizard must be either placed in a DLL or a Delphi Package. I have never tried the DLL method of extending the IDE so I will only be talking about adding Wizards to packages.

  Open the Repository through the File > New menu item in the IDE and choose Package.

New Package

Object Repository

 

  Save the Package to a name of your choice then add the above units into the Contains section of the package. Notice that Delphi will sometimes fill in the necessary packages the Requires section.

Wizard Package

Package Editor

  If it does not it can be like looking for a needle in a haystack trying to find what package needs to be added to include a particular unit. Most packages reside in the $(DELPHI)\Lib folder. Starting with D6 Borland has tried to force the separation of runtime and designtime code. In doing this they have stopped shipping the source code for some units, moved units around as well as reorganized the structure of existing packages.

  Delphi 6 and 7 both have the ToolsApi.pas file contained in the $(DELPHI)\Lib\Designide.dcp package so it may be necessary to add this file to the Requires section of the package manually.

  The next step is to make sure the Wizard Package is only compiled into Design Time code. You may also insert a Description of your package, this description is what is shown in the Package Editor within the IDE. Lastly you may decide if the package should be only rebuilt explicitly or should be rebuilt whenever the compiler needs it recompiled. I always check the later.

Package Options

Package Options

 

Now the Package may be installed into the IDE. Compile the Package and push the Install button in the Package editor. At this point the following files exist:

  • OTAWizards.dpk - Contains the text description of what units are contained within the package as well as what other packages are needed to compile our package. Also the options set in the Package Options dialog are stored here.

  • Wizards.pas - Contains the actual code for the Wizard

  • WizardsReg.pas - Contains the code to register the Wizard with the IDE

  • OTAWizards.bpl - Contains the compiled code that is loaded into the IDE. This file can be found in the path that is defined in the Tool > Environment Options > Library dialog under BPL Output Path. By default it is in the $(DELPHI)\Projects\Bpl folder.

  • OTAWizards.dcp - Contains a binary image containing a package header and the concatenation of all dcu files in the package. This file can be found in the path that is defined in the Tool > Enviroment Options > Library dialog under DCP Output Path. By default it is in the $(DELPHI)\Projects\Bpl folder

  The Package is now installed into the IDE. It now may be installed/uninstalled through the IDE.

 


mustangpeak.net

  Last Modified on: