TextEdit: Spell Checker

A spell checker can be provided for TextEdit fields in forms displayed in the Genero Desktop Client (GDC).

When used, the GDC underlines unknown words. Right-click on the unknown word to access a list of suggestions for the word.

Figure: Spell checker window flow


The figure shows examples of the contextual menu showing alternate spellings of the questionable term.

Providing dictionary files

The spell checker uses Hunspell (see http://hunspell.sourceforge.net/). Hunspell is the default spell checker for OpenOffice.org or Mozilla tools.

You must provide the Genero Desktop Client (GDC) with two dictionary files for each language. These files can be downloaded from http://extensions.openoffice.org/. Extract the files in the oxt archive.

For each language, you create a style for TextEdit fields and specify the two files for the spellCheck StyleAttribute using the following format:
"<affix file>|<dictionary file>"

You can load dictionary files via a URL, or by using the fgl_putfile() built-in function. If there is an error loading dictionary files, spell checking is simply not done. No error will be reported by the application.

Note: Loading the dictionary can take time. For instance, it takes approximately 5 seconds for the French dictionary to load. As a result, spell checking may not be immediate when loading a form.

Loading dictionary files from a URL

Tip: This is the recommended method for loading dictionary files.
The files can be loaded via a URL. Specify the URLs using the spellCheck StyleAttribute:
<Style name="TextEdit.spellfr">
  <StyleAttribute name="spellCheck" value="http://localhost:6394/fr_FR.aff|http://localhost:6394/fr_FR.dic" />
</Style>

Loading dictionaries using fgl_putfile

The files can be stored on the Runtime System side and can be uploaded to the GDC using fgl_putfile().

By default, files are read from the directory where the GDC executable resides. For example, this style definition specifies the dictionaries for the "US English Spell Checking Dictionary", and the files are expected to be in the directory with the GDC executable:
<Style name="TextEdit.spellUs">
  <StyleAttribute name="spellCheck" value="en_US.aff|en_US.dic" />
</Style>

The dictionariesDirectory parameter for the standard.feInfo frontcall can be used to get the directory where spell checker dictionary files are to be uploaded. This ensures that the directory is correct for the current version of GDC.

Alternatively, you can specify an absolute path:

<Style name="TextEdit.spellUs">
  <StyleAttribute name="spellCheck" value="file:///c:/dicts/en_US.aff|file:///c:/dicts/en_US.dic" />
</Style>