TX Text Control: Using a Customizable SpellCheckDialog with Multiple TextControls

An unique advantage of TX Spell .NET is that a single instance of the spell check component can be used to provide spell checking capabilities to an unlimited number of controls. To enable spell checking for a TextControl, the SpellChecker property of TextControl must be simply set to the specific TXSpellChecker instance.

The source code is contained in the following directories:

  • %USERPROFILE%\My Documents\TX Spell 7.0.NET for Windows Forms\Samples\WinForms\CSharp\TextControl\SpellCheckDialog on multiple controls
  • %USERPROFILE%\My Documents\TX Spell 7.0.NET for Windows Forms\Samples\WinForms\VB.NET\TextControl\SpellCheckDialog on multiple controls

If a customizable SpellCheckDialog is used, the Proofing.TXSpellChecker.SpellCheckDialogClosing event can be used to link to another TextControl when the current control has been checked completely. This allows to usage of one instance of the dialog to spell check an unlimited number of TextControls.

private void txSpellChecker1_SpellCheckDialogClosing(object sender,
    TXTextControl.Proofing.SpellCheckDialogClosingEventArgs e) {

    if (e.StateManager.NextMisspelledWord != null) {
        // The dialog was closed by user before checking all misspelled words.
        return;
    }
    e.Cancel = SetNextTextControl(e.StateManager, curTextControl);
}
Private Sub txSpellChecker1_SpellCheckDialogClosing(sender As Object, _
    e As TXTextControl.Proofing.SpellCheckDialogClosingEventArgs)
    If e.StateManager.NextMisspelledWord IsNot Nothing Then
        ' The dialog was closed by user before checking all misspelled words.
        Return
    End If
    e.Cancel = SetNextTextControl(e.StateManager, curTextControl)
End Sub

Start the sample application and click on the button Spell Check Dialog. The dialog checks each of the four TextControls and every contained TextPart such as headers, footers or text frames.

Image