The Delphi IDE is extensible in many ways, by adding your own menu items, tool bar buttons, dynamic form-creation wizards, and more, using the Open Tools API (Tools API).
The all mighty "ToolsAPI"
All of the Tools API declarations reside in a single unit, ToolsAPI.PAS. To use the Tools API you must build your Delphi IDE Add-In as a design-time package.Using the Tools API is simply a matter of writing classes that implement certain interfaces, and calling on services provided by other interfaces.
Sample Menu Add-In: About Delphi Programming RSS Reader
The Current Headlines in Delphi Programming article describes what a menu wizard is and how to install it in the Delphi IDE.The "About Delphi Programming Current Headlines" is an implementation of the IOTAMenuWizard - automatically added to IDE Help menu.
The package contains two forms (main and an "about" form) plus a unit that implements all the necessary OTA interfaces. Here's the wizard's code:
unit ADPCHSticker;Every wizard class must implement at least IOTAWizard, thus a starting point for your wizard is the TNotifierObject class.
interface
uses
ToolsAPI, Windows, SysUtils, Classes, Forms, Messages, Menus;
type
TADPCHStickerWizard = class(TNotifierObject, IOTAWizard, IOTAMenuWizard)
public
{ IOTAWizard }
function GetIDString: string;
function GetName: string;
function GetState: TWizardState;
procedure Execute;
{ IOTAMenuWizard }
function GetMenuText: string;
end;
procedure Register;
implementation
uses uMainForm;
const
SADPMenuIdString = 'ADP.Headlines';
SADPMenu = 'About Delphi Programming: Current Headlines...';
procedure Register;
begin
RegisterPackageWizard(TADPCHStickerWizard.Create) ;
end;
procedure TADPCHStickerWizard.Execute;
begin
if ADPHeadlinesForm = nil then ADPHeadlinesForm := TADPHeadlinesForm.Create(Application) ;
ADPHeadlinesForm.Show;
ADPHeadlinesForm.BringToFront;
end;
function TADPCHStickerWizard.GetIDString: string;
begin
Result := SADPMenuIdString;
end;
function TADPCHStickerWizard.GetMenuText: string;
begin
Result := SADPMenu;
end;
function TADPCHStickerWizard.GetName: string;
begin
Result := SADPMenuIdString;
end;
function TADPCHStickerWizard.GetState: TWizardState;
begin
Result := [wsEnabled];
end;
procedure InitWizard;
begin
// nothing needed
end;
procedure DoneWizard;
begin
if ADPHeadlinesForm <> nil then FreeAndNil(ADPHeadlinesForm) ;
end;
initialization
InitWizard;
finalization
DoneWizard;
end.
To create the menu wizard you need to implement two additional interfaces: IOTAWizard and IOTAMenuWizard.
The above is the skeleton code you can use for all your custom menu wizards.
Download, Build and Install
You can either download the compiled Turbo Delphi / BDS 2006 version of this Delphi Add-In, or download the full source code.To install the BPL (compiled package) version, follow these steps.
If you decide to go for the source code, select the package in the Project Manager, compile then select "Install...".


