Spell Checker written in Visual Dataflex
By Tony Mackay
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
Forward Send Construct_Object
Class cDbEditSpell is a DbEdit
Forward Send Construct_Object
Here are the Features
- User definable Preferences.
- Check as you type.
- Ignore All-Caps
- Spell Checking
- Check as you type
- Check marked blocks of text
- Check all text
- Right clicking on marked word will display word definition
- Add words to personal dictionary.
- Spell Check Dialog features
- Ignore All
- Change All
- Add word to personal dictionary
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.
~ 12,5 Mb in size