Knowledgebase Home Page  >  RapidSpell Desktop .NET  >  Behavior Customization
Search the Knowledge Base
How can I programmatically ignore certain regions in the text with RapidSpellDialog? (C#)
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=151&catId=62

Options

Print this page
Email this to a friend

[For a how-to with RapidSpellAsYouType, using it's IsInIgnorePos method, please see http://keyoti.com/kb/Default.aspx?ToDo=view&questId=114&catId=44]

 

 

 




1. add the following class

 

class CustomRapidSpellChecker : Keyoti.RapidSpell.RapidSpellChecker

{

public int CheckRegionStart, CheckRegionEnd;

public override Keyoti.RapidSpell.BadWord NextBadWord()

{

Keyoti.RapidSpell.BadWord bw = base.NextBadWord();

if (bw == null) return null;

else

{

if (wordStart >= CheckRegionStart && wordEnd <= CheckRegionEnd)

return bw;

else

return NextBadWord();

}

}

}


 

2. Then use this class before starting the dialog checker,

CustomRapidSpellChecker checker = new CustomRapidSpellChecker();

rapidSpellDialog1.CheckerEngine = checker;

checker.CheckRegionStart = 5;

checker.CheckRegionEnd = 10;

theTextBox.SelectionStart = 0;

rapidSpellDialog1.Check();

 

In this example we only check text from char positions 5 to 10.  It is of course possible to have multiple regions to ignore, this can be done by modifying the NextBadWord override.

Setting the selection start to 0 is important since wordStart and wordEnd are relative to the cursor position when the checker is started.


 


Related Questions:

Attachments:

No attachments were found.