Delphi Programming

  1. Home
  2. Computing & Technology
  3. Delphi Programming

Delphi IDE Add-In: Simple About Delphi Programming RSS Reader

BDS 2006, Turbo Delphi - About Delphi Programming News

By Zarko Gajic, About.com

Delphi IDE Add-In: Simple About Delphi Programming RSS Reader

Delphi IDE Add-In: Simple About Delphi Programming RSS Reader

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;

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.
Every wizard class must implement at least IOTAWizard, thus a starting point for your wizard is the TNotifierObject class.

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...".

Explore Delphi Programming

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Delphi Programming

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Advanced Delphi Techniques
  5. Delphi IDE Add-In: Simple About Delphi Programming RSS Reader

©2009 About.com, a part of The New York Times Company.

All rights reserved.