Knowledgebase Home Page  >  RapidSpell Desktop .NET  >  3rd Party Ctrls
Search the Knowledge Base
How do I spell check multiple text boxes with RapidSpellDialog, if I have a mix of TextBox/RichTextBox controls AND third party controls?
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=38&catId=61

Options

Print this page
Email this to a friend
For Version 4 Up
 
You can easily assign any text box (TextBoxBase or 3rd Party components) using the AddTextComponent method in RapidSpellDialog.  No special coding is required.
 
 
For Version 3
 
To do this you need to create a class that wraps TextBoxBase derived classes (System.Windows.Forms.TextBox and RichTextBox) with our ISpellCheckableTextComponent interface, this allows you to set them in the ThirdPartyTextComponentsToCheck array (instead of directly in TextBoxBasesToCheck).
 

For example, if you have 3 text boxes; textBox1 and textBox3 are of type System.Windows.Forms.TextBox and you are using our Infragistics control adapter to spell check an UltraTextEditor control - set the components to be checked;
 

this.rapidSpellDialog1.ThirdPartyTextComponentsToCheck = new Keyoti.RapidSpell.ISpellCheckableTextComponent[]{

new TextBoxBaseWrapper(textBox1),

theInfragisticsAdapter,

new TextBoxBaseWrapper(textBox3)

};

 
And add this class to your project (change the namespace appropriately).

using System;

using System.Windows.Forms;

using Keyoti.RapidSpell;

namespace MultipleTextBoxes

{

/// <summary>

/// Wraps TextBox and RichTextBox controls in an ISpellCheckableTextComponentInterface so that they

/// can be used in a ThirdPartTextComponentsToCheck array, with other non TextBoxBase controls.

/// </summary>

public class TextBoxBaseWrapper : Keyoti.RapidSpell.ISpellCheckableTextComponent

{

TextBoxBase tb;

public TextBoxBaseWrapper(TextBoxBase tb)

{

this.tb = tb;

this.tb.GotFocus += new EventHandler(this.OnGotFocus);

}

~TextBoxBaseWrapper()

{

if(tb!=null)

tb.GotFocus -= new EventHandler(this.OnGotFocus);

}

public event EventHandler GotFocus;

void OnGotFocus(object s, EventArgs e)

{

if(GotFocus!=null) GotFocus(this,e);

}

public void ScrollToCaret()

{

tb.ScrollToCaret();

}

public bool HideSelection

{

get{return tb.HideSelection;}

set{tb.HideSelection = value;}

}

public string SelectedText

{

get{return tb.SelectedText;}

set{tb.SelectedText=value;}

}

public int SelectionStart

{

get{return tb.SelectionStart;}

set{tb.SelectionStart=value;}

}

public int SelectionLength

{

get{return tb.SelectionLength;}

set{tb.SelectionLength=value;}

}

public string Text

{

get{return tb.Text;}

set{tb.Text=value;}

}

}

}


Related Questions:

Attachments:

No attachments were found.