2009. november 15., vasárnap

Create a simple Delphi Expert

Problem/Question/Abstract:

How to create a simple Delphi Expert

Answer:

This unit must be compiled into a package and then will appear in the delphi Help menu.

unit SDCSimpleExpert;

interface

uses ToolsApi;

type
TSDCSimpleExpert = class(TNotifierObject, IOTAMenuWizard, IOTAWizard)
public
function GetIDString: string;
function GetName: string;
function GetState: TWizardState;
procedure Execute;
function GetMenuText: string;
end;

procedure Register;

implementation

uses Dialogs;

procedure Register;
begin
{register expert}
RegisterPackageWizard(TSDCSimpleExpert.Create);
end;

{ TSDCSimpleExpert }

procedure TSDCSimpleExpert.Execute;
begin
{code to execute when menu item is clicked}
ShowMessage('Hello Simple Expert.');
end;

function TSDCSimpleExpert.GetIDString: string;
begin
{unique expert identifier}
Result := 'Hello.SimpleExpert';
end;

function TSDCSimpleExpert.GetMenuText: string;
begin
{caption of menu item in help menu}
Result := 'Simple Expert';
end;

function TSDCSimpleExpert.GetName: string;
begin
{name of the expert}
Result := 'Simple Expert';
end;

function TSDCSimpleExpert.GetState: TWizardState;
begin
Result := [wsEnabled];
end;

end.


Nincsenek megjegyzések:

Megjegyzés küldése