|
Menu
Wizard Unit
In order to add a new Wizard to the Delphi Help you must
implement an object that supports IOTAMenuWizard. To simplify this
the OTA defines TNotifierObject that supports the basic methods for
IOTAWizard. If we derive from this class we can concentrate on the
methods needed for menu.
Notice here you must explicitly define the interfaces IOTAWizard
and IOTAMenuWizard
|
TSampleWizard = class(TNotifierObject,
IOTAWizard, IOTAMenuWizard) |
to ensure that they are all defined when the IDE
queries for each interface.
|
IOTAMenuWizard = interface(IOTAWizard)
['{B75C0CE2-EEA6-11D1-9504-00608CCBF153}']
function GetMenuText: string;
end; |
Every Menu Wizard will start from as unit
similar to the following.
|
unit MenuWizard;
interface
{$I Compilers.inc} //
Compiler Defines
uses
SysUtils, Windows, Controls, ToolsApi;
type
TSampleMenuWizard = class(TNotifierObject,
IOTAWizard, IOTAMenuWizard)
// IOTAWizard
function GetIDString: string;
function GetName: string;
function GetState: TWizardState;
procedure Execute; virtual;
// IOTAMenuWizard
function GetMenuText: string;
end;
implementation
{ TSampleWizard }
procedure TSampleMenuWizard.Execute;
begin
MessageBox(0, 'Executed Wizard', 'Hi', MB_OK);
end;
function TSampleMenuWizard.GetIDString: string;
begin
//
// Unique name for the
Wizard used internally by Delphi
//
Result := 'MustangPeak.SampleWizard';
end;
function TSampleMenuWizard.GetMenuText: string;
begin
//
// Name used for Menu Text
//
Result := 'MustangPeak Menu Item'
end;
function TSampleMenuWizard.GetName: string;
begin
//
// Name used for user
messages and in the Object Repository if
// implementing a
IOTARepositoryWizard object
//
Result := 'MustangPeak Sample Wizard';
end;
function TSampleMenuWizard.GetState: TWizardState;
begin
//
// For Menu Item Wizards only
//
Result := [];
end;
end. |
The next step is the registration of the Wizard with Delphi. 
|