IWPSpell Interface

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

Interface to modify properties of the optional spell check feature.

Description

You can use this interface to load dictionaries from certain directories, select the language which is currently used and load or save the current setup to registry or INI file.

 

If you do not use this interface the setup will be load and saved to the registry key Software\WPCubed\WPSpell.

You can use the method SetSetupPersistency to manually select registry and time when the setup is loaded.

 

Start - Stop Spellcheck:

 

Use the method TextCommand(7,mode) to start and stop spllcheck.

 

The following values are allowed for mode:

 0=Start SpellCheck (using the internal spellchecker),

 1= Start Thesuarus (reserved),

 2=Start SpellAsYouGo (internal or external),

 3=Stop SpellAsYouGo, (internal or external),

 4=Show SpellCheckSetup (internal only).

 

This "wpa" actions can also be used, for example with wpaProcess(wpa_name):

 

 "DiaSpellcheck",

 "DiaSpellOptions",

 "Spellcheck",

 "SpellAsYouGo".

 

"SpellAsYouGo" can be called with parameter "1" to switch the online spell check (curly underlines) ON or with parameter "0" to switch it OFF. If no parameter is used the state will be toggled.

 

Example C#:

 

      private void Form1_Load(object sender, EventArgs e)

       {

           wpdllInt1.EditorStart(licname, lickey);

           wpdllInt1.SetLayout("{dll}\buttons.pcc", "default", "", "main", "main");

           wpdllInt1.SetEditorMode(EditorMode.wpmodSingleEditor,

                 EditorXMode.wpmodexSpellcheck | EditorXMode.wpmodexToolbarLG,

                EditorGUI.wpguiVertScrollBar | EditorGUI.wpguiRuler |

                EditorGUI.wpguiHorzScrollBar |EditorGUI.wpguiPanelH1,

                 EditorGUI.wpguiDontSet);

 

          // Load the DCT Files

           wpdllInt1.SpellCtrl.AddFromPath(@"{dll}\DCTs");

 

          // Select English

           wpdllInt1.SpellCtrl.SetLanguage("English");

 

          // Activate SpellAsYouGo

           wpdllInt1.wpaProcess("SpellAsYouGo", ""); // Switch on Spell-As-You-Go

       }

 

 

Example - VB6:

 

Private Sub Form_Load()

    On Error GoTo Error_Trap

    ' set license

    WPDLLInt1.EditorStart "your license name", "your license code"

 

    ' load PCC file

    WPDLLInt1.SetLayout App.Path & "\Buttons.PCC", "Default", "", "main", "main"

    

    ' initialize editor

    WPDLLInt1.SetEditorMode 0, 1 + 4 + 8, 2 + 4 + 8 + 16 + 64 + 128 + 256 + 1024, 0

    

    'Load Dictionary

    WPDLLInt1.SpellCtrl.AddFromFile App.Path & "\English.DCT"

    

    ' Set "English" as standard Language

    WPDLLInt1.SpellCtrl.SetLanguage "9" ' Select English

    

    ' Switch ON "Spell-As-You-Go"

    WPDLLInt1.wpaProcess "SpellAsYouGo", "1"

    

    Form_Resize

 

Exit_Routine:

    On Error Resume Next

    Exit Sub

Error_Trap:

    ErrHandler Err.Number, Err.Description, EGO, "Form_Load"

    Resume Exit_Routine

End Sub

 

 

Tip: You can also use the method CommandEx(9500, n, strparam) to execute some of the methods. This may be useful if you cannot access the interface in your developing language.

Custom Spellchecking: You can also use your own check routine with TextDynamic, you will need your own dictionary API. This will disable the integrated spell check engine.

To activate custom spellchecking use Command(907)

Use a parameter=0 to disable custom spellcheck, use a parameter = A (any number) to enable it. The event OnEnumParOrStyle will be triggered to check words with EventParam=A. Also see OnMouseDownWord which can be used to create a popup menu. You should call Command(907) before SetEditorMode.


[idh_interface_iwpspell.htm]    Copyright © 2007 by WPCubed GmbH