TX Spell .NET for Windows Forms

What's New in TX Spell .NET for Windows Forms 3.0

Topic

Better suggestions and a user interface you can adapt are what TX Spell .NET for Windows Forms 3.0 brought. A new suggestion engine weighs how typos happen on a keyboard, a spell check dialog of its own works with any control, and events, context menu items and dictionaries from memory open the spell checker to code of your own.

Version 3.0 was released on September 12, 2012, for Windows Forms and WPF, as the blog article TX Spell .NET 3.0 Released: New Suggestion Engine, Customizable Dialog announced. Unlike the versions after it, it came out on its own, a few weeks after TX Text Control X8. The features below are the ones added since version 2.0; Version 4.0 followed in November 2013.

Version 3.0 at a Glance

AreaWhat is new
SuggestionsRanking that measures the distance between keys on the keyboard
Spell check dialogA customizable SpellCheckDialog for TX Text Control and other controls
EventsEvents for dictionaries, user dictionary words, dialog buttons, menu items and word changes
DictionariesDictionaries loaded from and saved to string arrays
Context menusGetMenuItems, which returns ready-made menu items
Code without a user interfaceThe TXSpell class
Service packsService Pack 1 in November 2012 and Service Pack 2 in June 2013

Suggestion Quality

Text Control reworked how suggestions for a misspelled word are found and ranked. The suggestion engine measures the distance between the keys of the keyboard in use and rates the candidates by it, so a typo caused by hitting a neighboring key ranks its intended word high. In Text Control's tests with thousands of documents, the expected word was ranked first or second in more than 97 percent of the cases.

The preview article Upcoming TX Spell .NET 3.0 Features gives the background: the goal had been more than 90 percent, and the test data came from internal chat protocols and documents with typical typos. Incorrect Words and Suggestions shows how suggestions are created today.

The Spell Check Dialog

Before version 3.0, the spell check dialog was part of TX Text Control. Version 3.0 brought a dialog of its own, which you open with Show of the object that TXSpellChecker.SpellCheckDialog returns:

  • Any control. The dialog checks a TX Text Control, a RichTextBox, a TextBox or a GridView, and one dialog can check several controls in a single pass.
  • Customizable. Its buttons are DialogButton objects in three collections, ChangeButtons, IgnoreButtons and OptionButtons, which you can rename, disable, remove or extend with buttons of your own. The Preview, the SuggestionList and the SuggestionDictionaryComboBox have settings of their own, such as the color of the incorrect word and the maximum number of suggestions.
  • Controlled by events. SpellCheckDialogOpening, SpellCheckDialogClosing and DialogButtonClicked pass a SpellCheckDialogStateManager, which tells which word comes next and can set another one or close the dialog.
  • Options. OptionsDialog opens the built-in options dialog, and OptionsDialogOpening can cancel it, for example to show a dialog of your own.

Spell Check Dialog, Customizing the Spell Check Dialog and Checking Multiple Controls describe the dialog as it works today.

New Events

Version 3.0 raises events when something changes in the spell checker:

  • Dictionaries. DictionaryAdded and DictionaryRemoved occur when a dictionary is added to or removed from Dictionaries.
  • User dictionaries. UserDictionaryWordAdded and UserDictionaryWordRemoved occur when a word is added to or removed from a user dictionary.
  • Word changes. IncorrectWordChanging and MisspelledWordChanging occur when the dialog or the context menu is about to change a word, in a text or in a TX Text Control.
  • User interface. DialogButtonClicked and MenuItemClicked occur when the user clicks a button of the dialog or an item of the context menu.

Events lists all events of today's version.

Dictionaries From Memory

Dictionaries no longer have to be files. A new constructor of OpenOfficeDictionary takes the lines of the .dic and the .aff file as string arrays, together with the language, and user dictionaries can be loaded from and saved to string arrays as well. This lets dictionaries come from a database or from resources embedded in an assembly. The blog article TX Spell .NET 3.0: Loading Dictionaries from Embedded Resources showed this at the time; Loading and Managing Dictionaries and User Dictionaries show it with today's API.

Context Menus

GetMenuItems returns an array of MenuItem objects for a misspelled word, ready to go into a context menu of your own next to your own entries. The Type of an item is one of the values AddToDictionary, Delete, IgnoreAll, IgnoreOnce, NoSuggestions and Suggestion of MenuItemType. Context Menus builds such a menu.

About the Member List

The What's New documentation of version 3.0 counts the TXSpellChecker class and members such as CreateSuggestions, Suggestions and Dictionaries among the new ones, although blog articles published before the release, such as TX Spell .NET: Creating Custom Context Menus, already use them before version 3.0 was released. The list below follows the documentation of version 3.0 and shows the API of TX Spell .NET as it stood with that version.

Service Packs

Service packReleasedSetup
Service Pack 1November 22, 2012A new full version setup, installed with Repair
Service Pack 2June 25, 2013TX Spell .NET for Windows Forms 3.0 SP2.exe

Service Pack 1 made version 3.0 compatible with Visual Studio 2012, as the blog article TX Spell .NET 3.0 SP1 - Visual Studio 2012 Compatibility Pack Released described. Service Pack 2 fixed known issues; TX Spell .NET 3.0 Service Pack 2 Released announced it. The download package holds no separate setup for Service Pack 1. Its setup of Service Pack 2 is dated June 24, 2013, and the full installer of version 3.0, TX Spell .NET for Windows Forms 3.0.exe, June 18, 2013.

New Classes, Properties, Methods and Events

These are the classes and members that the What's New documentation of version 3.0 lists. All names are relative to the TXTextControl.Proofing namespace, and each links to its current reference page.

New Classes

Members by Class

ClassPropertiesMethodsEvents
DialogButtonEnabled, Font, IsDeleteButton, IsUndoEditButton, Text, Type
DialogButtonCollectionItemAdd, AddRange, Remove
DialogButtonEventArgsDialogButton, StateManager
DictionaryLanguage
DictionaryAddedEventArgsDictionary
DictionaryCollectionHasEditableUserDictionaries, ItemAdd, GetItem, Remove
DictionaryRemovedEventArgsDictionary
IncorrectWordChangingEventArgsCorrectedText, CorrectedWord, IncorrectWord, SourceText, Type, WillBeDuplicate
MenuItemType
MenuItemClickedEventArgsMenuItem
MisspelledWordChangingEventArgsCorrectedWord, IFormattedText, MisspelledWord, Type, WillBeDuplicate
OptionsDialogOpeningEventArgsCancel
PreviewEditable, IncorrectWordColor
SpellCheckDialogAcceptButton, ChangeButtons, ChangeInAllTextParts, CloseOnFinished, Font, HideSelection, IgnoreButtons, IgnoreInAllTextParts, OptionButtons, Preview, ShowMessageBoxes, SuggestionDictionaryComboBox, SuggestionListShow
SpellCheckDialogClosingEventArgsCancel, CloseReason, StateManager
SpellCheckDialogOpeningEventArgsStateManager
SpellCheckDialogStateManagerNextIFormattedText, NextIncorrectWord, NextMisspelledWordClose, SetNext
SpelledWordIndex, Length, Start, Text
SuggestionDictionaryComboBoxIsAllItemEnabled, IsAllItemSelected, SuggestionDictionary
SuggestionListIsNoSuggestionsItemEnabled, MaxSuggestions
TXSpellAvailableDictionaries, Dictionaries, IgnoreCase, IgnoreWord, IncorrectWords, Language, SuggestionsCheck, Create, CreateSuggestions
TXSpellCheckerAvailableDictionaries, Dictionaries, IgnoreCase, IgnoreWord, IncorrectWords, Language, SpellCheckDialog, SuggestionsCheck, Create, CreateSuggestions, GetMenuItems, OptionsDialogDialogButtonClicked, DictionaryAdded, DictionaryRemoved, IncorrectWordChanging, MenuItemClicked, MisspelledWordChanging, OptionsDialogOpening, SpellCheckDialogClosing, SpellCheckDialogOpening, UserDictionaryWordAdded, UserDictionaryWordRemoved
UserDictionaryWordAddedEventArgsAddedWord, UserDictionary
UserDictionaryWordRemovedEventArgsRemovedWord, UserDictionary

Next Steps