Hi, yes here's how to approach it. Add this subclass
Code:
class CustomRapidSpellChecker : RapidSpellChecker
{
protected override bool IsWord(int wordStart, int wordEnd)
{
if (!base.IsWord(wordStart, wordEnd))
{
//see if its actually multiple spaces
if (wordEnd - wordStart > 1 && theText.ToString(wordStart, wordEnd - wordStart).Contains(" "))
return true;//yes we want it treated like a word
else
return false;
}
else return true;
}
protected override bool LookUpMainDictionary(string query)
{
return base.LookUpMainDictionary(query) && !query.Contains(" ");
}
protected override ArrayList FindSuggestions(string word, bool searchLowerCase)
{
if (word.Contains(" ")) return new ArrayList(new string[1] { " " });
else
return base.FindSuggestions(word, searchLowerCase);
}
}
and then hook it up like this
Code:
rapidSpellAsYouType1.RapidSpellChecker = new CustomRapidSpellChecker();
I didn't try it but usage with RapidSpellDialog should just be
rapidSpellDialog1.CheckerEngine = new CustomRapidSpellChecker();
It may need a little refinement, for example it will suggest " " as a correction for a string like " ." - so you could modify FindSuggestions to be a bit smarter than the code I've given.
The one thing that isn't so great about it is that the suggestion item will be a " ", so it doesn't look like much to the user. One solution would be to delete the FindSuggestions override and then no suggestion is shown - and the user hopefully can see for themselves what the problem is.
-Harry
-Harry