Consultancy and Programming
Advice, tips, techniques and downloads for Visual Foxpro developers.
One feature which Visual Foxpro lacks is a built-in spell checker that can be distributed with your applications. There are a number of ways of overcoming this, but, in my experience, none is deal. For example, you could use OLE Automation with Microsoft Word, but this is slow, heavy on resources, and tends to be unreliable.
What is needed is a utility that can be integrated seamlessly with Visual FoxPro, provides all the functionality of a full-blown spell-checker, and can easily be distributed with your own applications.
A major application that I have written involves producing calibration certificates for various kinds of instrumentation. This involves producing a document that contains measurements taken from an instrument, along with some related text. The application allows the calibration engineers to enter the readings directly into the computer, and to print the final certificate to be sent back to the customer. Engineers tend to make a lot of spelling mistakes, and this has been a major source of complaints from customers.
The solution that I adopted was to incorporate the Strategic Edge Foxspell Checker into my application. Foxspell Checker comes as 100 percent Visual FoxPro, FoxPro/Windows 2.x or Foxpro/DOS source code, in a form that can be quickly integrated into your own applications, and can be distributed royalty-free. The spell-checker provides all the facilities that you would expect, and these are available through a friendly user interface.
Here are the product's main features:
The product costs US$249, and can be purchased for email delivery direct from Strategic Edge (www.strategicedge.com) in San Francisco (this is the method I used), or it can be bought from third-party tools suppliers such as Hallogram ( www.hallogram.com).
Only US English dictionaries are available with the product. However, this is not a real problem for users of British English because the British versions of words that are spelt differently can be put into a text file, and this can be appended to the dictionaries in one hit by using the tools provided.
I have found that the Foxspell Checker is very fast. As it is run by calling a standard program file (PRG), it comes up straight away. And because of the way that the dictionaries have been constructed, it locates words very quickly.
The way that this works is to break the dictionary up into three tables. The first table stores words between one and eight characters; the second table contains words with nine to 12 characters; and the last table stores words with 13 characters or more. This scheme reduces disk space by almost 50 percent, compared to what would be needed if only one 20-character field was used.
Also, a system of recycling deleted records is used to allow new additions to the dictionary to occupy the space of deleted records. This avoids the need to pack the dictionary tables.
There are some limitations on the way that the spell-checker is invoked. In particular, you cannot rely on using the Edit menu if you need to use the spell checker on a modal form, as the new pad added to this menu will be greyed out. The documentation also warns that this approach might not work on forms in which the controls to be checked are embedded in a page frame. I chose to add command buttons to my forms where the spell-checker is needed, including forms with page frames, and I have had no problems with implementing it this way.
Another point to watch is the fact that, by default, the spell-checker will only work on the standard text box, edit box and grid controls that come with Visual FoxPro. If you have sub-classed these controls, you will need to edit the source code and replace the standard class names with whatever class names you have used. All the source code is provided, and it is very well commented, so making this change is straightforward.
I have had very positive feedback on the spell-checker from my users. Previously, I had implemented spell checking via OLE Automation with Word 97. The users had struggled for months with this. They were delighted with the speed and user-friendliness of the new method.
From a systems administration point of view, I have found that the burden put upon our file server has reduced considerably. As we operate a Windows NT Terminal Server with Citrix thin-client technology, the server was continually loading and unloading Word every time it was needed. I also found that Word did not always close down every time, and I have seen instances where a single user had Word running more than a dozen times.
The Foxspell Checker has made a major improvement to my application. Previously, there were engineers who would not use the Word method of spell-checking because it was so slow and cumbersome. These people are now happily using the new facility because of its speed and ease of use. In future releases of my application I plan to introduce the spell-checker to other areas, such as fax generation and data critical forms.
Note added January 2006: French, German and Spanish dictionaries are now available for Foxspell Checker, at a cost of US$125 each.
Mike Lewis Consultants Ltd. October 2000. Revised January 2006.
FoxStuff is maintained by Mike Lewis Consultants Ltd. as a service to the VFP community. Feel free to download and use any code or components, and to pass around copies of the articles (but please do not remove our copyright notices or disclaimers).
The information given on this site has been carefully checked and is believed to be correct, but no legal liability can be accepted for its use. Do not use code, components or techniques unless you are satisfied that they will work correctly in your applications.
© Copyright Mike Lewis Consultants Ltd.