How Tos

Last reviewed: 12/15/2011

Article ID: H071119

HOW: Developing Delphi applications that manage lexicons

The information in this article applies to:

  • LexiconKit 4


You can develop Delphi applications that manage lexicons using your favorite version of Delphi.

More Information

LexiconKit includes a Delphi Pascal source file LexiconKit.pas comprised of the Delphi classes that manage lexicons. It also includes a Delphi Pascal source file ChantShared.pas comprised of common Delphi classes that all Chant libraries use.

To access the LexiconKit Delphi classes within your application, first add a project reference to the LexiconKit Delphi source file:

  1. Within your Delphi project, select Project Options.
  2. Select the Delphi compiler options.
  3. Add Search path reference to the LexiconKit unit source file directory: C:\Program Files\Chant\LexiconKit 4\Win32\Delphi\source.
  4. Add unit output path reference to the local directory with a period '.' character.

To access the LexiconKit Delphi classes within your application, add a reference to the ChantShared and LexiconKit units in your uses clause:

unit Unit1;


Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ChantShared, LexiconKit;

Add an event handler declaration and Object instance variable to the application declarations:

TForm1 = class(TForm)
{ Private declarations }
{ Public declarations }
procedure OnHasEvent(var msg: TMessage);
    message WM_APP+5;

Form1: TForm1;
ChantLM1: TChantLM;

Object Instantiation

Instantiate an instance, set the license and serial properties, and set the event handler message.

procedure TForm1.FormCreate(Sender: TObject);
ChantLM1 := TChantLM.Create();
// Set license properties

// Define the HasEvent callback message
ChantLM1.SetWindowMessage(Handle, WM_APP+5, 0, 0);


Event Callbacks

Event callbacks are the mechanism in which the component library sends information back to the application such as phoneme selection, import/export processing state, or there was an error.

procedure TForm1.OnHasEvent(var msg: TMessage);
aTChantLMEvent: TChantLMEvent;
i: Integer;
numberOfEvents := ChantLM1.GetResourceCount(CSREvent,0,0);
for i := 0 to numberOfEvents - 1 do
    // Get the event from the event queue
    aTChantLMEvent := ChantLM1.GetChantLMEvent(0);
    case tEvent.ChantCallback of



    // Remove the event from the event queue

Deployment Checklist

When you are ready to deploy your Delphi application, you need to ensure you have a valid license, bundle the correct Chant component library, and configure your installation properly on the target system. Review the following checklist before deploying your applications:

  • You may deploy your Delphi application to any system with a valid license from the Chant.
  • Copy CLexiconKit.dll to the target system and place in the same directory with your application.

Sample Projects

Delphi sample projects are installed at the following location:

  • My Documents\Chant LexiconKit 4\Win32\Delphi\RS 2007,
  • My Documents\Chant LexiconKit 4\Win32\Delphi\RS 2009,
  • My Documents\Chant LexiconKit 4\Win32\Delphi\RS 2010,
  • My Documents\Chant LexiconKit 4\Win32\Delphi\RS XE,
  • My Documents\Chant LexiconKit 4\Win32\Delphi\RS XE2, and
  • My Documents\Chant LexiconKit 4\Win32\Delphi\RS XE3.