Simple Dialog & As-you-type Checking in DevExpress RichEdit control.

Please see the DevExpressRichEdit demo project, which covers as you type and dialog spell checking support. We will be documenting this based on useage so let us know if you're using it and/or need help please (support@keyoti.com).

Simple Dialog & As-you-type Checking in TX Text Control

It may help to refer to the demo projects which are included with the product.

Basic Setup
  1. Open/create a project which uses TX Text Control
  2. Open the form holding TX Text Control, and drag on RapidSpellDialog.
  3. After the InitializeComponent call in the Form's constructor call rapidSpellDialog1.AddTextComponent(textControl1).
  4. Add a button or menu item and start RapidSpellDialog in it's click handler, calling RapidSpellDialog.Check().

At this stage the spell check should work, however a few changes are needed for optimal integration.

ContextMenuStrip for version TX v19+

In v19 TX controls the context menu internally, therefore it is necessary to integrate with it, rather than control it.

  1. Set RapidSpellDialog.ShowSuggestionsContextMenu = false
  2. Add a handler for the TextControl.TextContextMenuOpening event (if a handler doesn't already exist)
  3. In the handler, integrate any spelling suggestions:
    	ContextMenuStrip cm = e.TextContextMenu;
    
    	//Get the RS items
    	ToolStripItem[] suggestions = rapidSpellDialog1.GetSuggestionsToolStripItems();
    
    	//if there are suggestions (ie if the click was on a spelling error), show them
    	if (suggestions != null)
    	{
    	  cm.Items.Add(new ToolStripSeparator());
    	  cm.Items.AddRange(suggestions);
    	}
    	
ContextMenuStrip for versions up to and including TX v18

RapidSpellDialog will need to control the ContextMenuStrip for the Text Control. Therefore, unset the TextControl.ContextMenuStrip property in the designer, to null/Nothing/none. Then set RapidSpellDialog's ContextMenuStripDefault property to the ContextMenuStrip to use when the user clicks away from a spelling error.

In the regular TX Text Control examples, there is a MouseDown event handler, which is used to show the regular 'text context menu'. This should be commented out, so that the context menu strip is not manually shown on the MouseDown event - RapidSpell will take care of this.

In the regular TX Text Control examples, there is a TextFrameRightClicked event handler, which shows the context menu for textframes when the user right clicks on a frame edge. Modify textControl1_TextFrameRightClicked, by adding

//C#
if (rapidSpellDialog1.GetSuggestionsToolStripItems() == null)
{
...
}
'VB.NET
If RapidSpellDialog1.GetSuggestionsToolStripItems() Is Nothing Then
...
End If
around it's contents, so that the menu logic isn't performed when there are spelling suggestions.

Resetting Ignored Words (When Creating/Opening New Documents)

To reset the words that have been ignored for a document, call

rapidSpellDialog1.ResetIgnoredWords()

For example this would normally be done in these methods from the demo project; frmMain_DragDrop, textControl1_DragDrop, FileOpen, FileNew.