This article was brought to you by the guys from VDF-GUIdance.
For more DataFlex targeted articles see

Spell Checker written in Visual Dataflex

by Tony S Mackay


Spell Check as shown at DISD 2004

At the recent DISD conference Tony Mackay of Anasazi Software demonstrated a spell checker for Visual DataFlex applications.
Size: 12560 KB Download
Date Created: 16/03/2004
Date Updated: 16/03/2004
Author: Tony S Mackay
Company: Anasazi Software Inc.

Just for a little background to help understand why we chose to write a Spell Checker in our selves instead of using ActiveX.
When we started this project we fully intended to use one of many available ActiveX components on the market. We research and tried a few of them and it ended up to be beneficial to us to develop our own written fully in Visual Dataflex. The main reasons for this were to do with deployment issues.
SpellCheck will be installed on as many as 18-25 thousand users.
We would have been faced with registering an ActiveX component on each of these computers.
Another issue was floating staff members. We need the staff member to be able to access their personal dictionary from any where on the network.
Using a network database makes this very easy.
The Workspace provided has a Spell Check Tab on the "Controls Palette" if you want to experiment with the spell check from the IDE.
Notice that it uses a pkg file named cSpellControls.Pkg. If you don't want to use that just follow its example for your own classes. The main thing to note in cSpellControls is at the end where I use "cSpellCheckDg.pkg" and instantiate a "cSpellCheckPreferences". You need to do the same.
I tried to document all the methods and classes. I didn't use my spell checker on any of the doc.
Also take a look at the two src files WordPad.src and EditClass.src.
Don't put a lot of thought in the names of these programs.
They where just for testing.
Wordpad allows you to pull info in from the clipboard, spell check the text and push it back to the clipboard. Nothing spectacular.
EditClass has a DbEdit and a DbForm just for testing.

Code Examples to use SpellCheck

Class cDbFormSpell is a DbForm
  Import_Class_Protocol cFormSpellMixin

  Procedure Construct_Object
    Forward Send Construct_Object
    Send doDefinecFormSpellMixin


Class cDbEditSpell is a DbEdit
  Import_Class_Protocol cEditSpellMixin

  Procedure Construct_Object
    Forward Send Construct_Object
    Send doDefinecEditSpellMixin


Here are the Features

  1. User definable Preferences.
    1. Check as you type.
    2. Ignore All-Caps
  2. Spell Checking
    1. Check as you type
    2. Check marked blocks of text
    3. Check all text
    4. Right clicking on marked word will display word definition
    5. Add words to personal dictionary.
  3. Spell Check Dialog features
    1. Ignore
    2. Ignore All
    3. Change
    4. Change All
    5. Add word to personal dictionary
    6. Cancel
Here are a few other items of interest. The look and feel is very similar to most of the typical spell checkers that people are familiar with.
An additional feature we have is word definition lookup.
You can also spell check words as you enter the definition when adding to the personal dictionary.
We had concerns of network traffic due to spell check, so many techniques have been used to minimize the number of times the database is touched.
Speed comparisons ended up being better than most we compared.
We have also provided simple hooks to provide the programmer ease of customization.
Please understand that the data file named DICTMAIN has the words and definitions of a free dictionary I acquired from the WEB. It is by no means a complete dictionary. It lacks in plurals and words ending in "ing", "ed" etc. We used it for development only. When we get ready to deploy we'll purchase a dictionary to suit our needs. You will need to do the same.
See "SetupMain.src" for an example calculating the SoundEx Code for each word.

Download ~ 12,5 Mb in size