unit Simple;

// Trivial demonstration of the Delphi 4 wizard interface.

interface

uses Dialogs, ToolsAPI;

type
  TSimpleWizard = class(TInterfacedObject,
      IOTAWizard, IOTANotifier)
  public
    procedure AfterSave;           // IOTANotifier
    procedure BeforeSave;
    procedure Modified;
    procedure Destroyed;

    function GetIDString: string;  // IOTAWizard
    function GetName: string;
    function GetState: TWizardState;
    procedure Execute;

    constructor Create;
  end;

implementation

{ TSimpleWizard }
// Return a unique identifier. By convention, the identifier has two parts:
// organization & a wizard name.
function TSimpleWizard.GetIDString: string;
begin
  Result := 'Tempest Software.Simple Wizard';
end;

// Return a user-friendly name for the wizard. Delphi displays the name
// in error messages, and for repository wizards, in the object repository.
function TSimpleWizard.GetName: string;
begin
  Result := 'Simple Wizard';
end;

// Delphi never calls the following methods for an add-in wizard.
procedure TSimpleWizard.AfterSave;
begin
end;

procedure TSimpleWizard.BeforeSave;
begin
end;

procedure TSimpleWizard.Destroyed;
begin
end;

procedure TSimpleWizard.Modified;
begin
end;

// Execute matters only for menu, form, and project wizards.
procedure TSimpleWizard.Execute;
begin
end;

// GetState matters only for menu wizards.
function TSimpleWizard.GetState: TWizardState;
begin
  Result := [];
end;

constructor TSimpleWizard.Create;
begin
  inherited;
  ShowMessage('The Simple Wizard is trying to do something useful!');
end;

end.