Custom Spellcheck

[Top]  [Chapter]  [Previous]  [Next]



"Custom spell check" allows it to use an external data base with words to verify the spelling. We recommend to use the integrated spell check methods instead, because they guarantee high performance and compact dictionaries.  (Requires optional "spell" license)


But if you need to use an existing spell check solution, TextDynamic allows this, too:


Use a parameter=0 to disable custom spellcheck, use a parameter = A (any number) to enable it.


You should call Command(907) before SetEditorMode.


Please note, if you enable the "custom" spell check, the internal spell check feature is disabled!


The event OnEnumParOrStyle will be triggered to check words with EventParam=A. You have to change the variable Abort=true in case the word is wrong. You can use GetSubText to extract this word.


// Initialization



// Select Editor Mode !

WPDLLInt1.SetEditorMode( ...


// The event handler

private void WPDLLInt1_OnEnumParOrStyle(object Sender, bool IsControlPar, int StartPos,

   int Count, WPDynamic.IWPParInterface ParText,

   WPDynamic.IWPAttrInterface ParAttr, int EventParam,

   ref bool Abort)


   if (EventParam==1)


      if(ParText.GetSubText(StartPos,Count) == "right")  

           Abort = false;

      else Abort = true;




Please see the example at OnMouseDownWord. This event can be used to create a popup menu. If custom spell checking was activated bit 10 will be set in parameter Shift if the word was marked to be wrong.


You can use the Memo.TextCommand(7,ParamA,0) to start and stop spell check.


The following values are allowed for ParamA:

 0= Start SpellCheck (using the optional internal spellchecker),

 1= Start Thesuarus (reserved),

 2= Start SpellAsYouGo (internal or external),

 3= Stop SpellAsYouGo, (internal or external),

 4= Show SpellCheckSetup (internal only).


// Start SpellAsYouGo



// Stop SpellAsYouGo



With the method SetIProp it is possible to change the spell check strategy.


Memo.SetIProp(4,0) : Words are checked when the paragraph is initialized. The complete text is checked after loading

Memo.SetIProp(4,1) :  (default)  Words are checked before a paragraph is painted.

Memo.SetIProp(4,2) :  - check whole text first


Only in case the IWPSpell interface SpellCtrl cannot be used, use the following command 9500 to control in integrated spell checker:




Param=1: ClearAll - Remove all references to dictionaries

Param=2: Load setup from INI file specified by strparam

Param=3: Save setup to INI file specified by strparam

Param=4: Load setup from REGISTRY specified by strparam

Param=5: Save setup to REGISTRY specified by strparam

Param=6: AddFromPath - Load all DCT files from path specified by strparam

Param=7: AddFromFile - Load the DCT file specified by strparam

Param=8: UserDictAdd - set user dictionary to file

Param=9: UserDictRemove - set user dictionary to file

Param=10: SetLanguage - activate the language specified by strparam

Param=11: Execute command - editor 1, mode = strtoint(strparam)

Param=12: Execute command - editor 2, mode = strtoint(strparam)



[custom_spellcheck.htm]    Copyright © 2007 by WPCubed GmbH