Error Indication Support
BCGControlBar Pro (MFC)
BCGSuite (MFC)
BCGControlBar for .NET
There is a built-in, simple, and flexible mechanism that allows you to specify incorrect words or spelling errors, display them with a red curved line under the text, and show a list of suggested corrections in the context menu for each word.
Sample code:
BOOL CCustomEditCtrl::IsCorrectWord(
const CString& strWord,
int iWordStart,
int nColorBlockID) const
{
UNREFERENCED_PARAMETER(iWordStart);
UNREFERENCED_PARAMETER(nColorBlockID);
if (theApp.m_lstCustomDictionary.Find(strWord) != NULL)
{
return TRUE;
}
if (theApp.m_lstIgnoreSpelling.Find(strWord) != NULL)
{
return TRUE;
}
// Used in C++ example:
return strWord != _T("CMyClaass") &&
strWord != _T("toobar") &&
strWord != _T("examle");
}
void CCustomEditCtrl::GetWordCorrections(
const CBCGPEditErrorIndicator& wordInfo,
CStringArray& arSuggestions,
CStringArray& arCustomActions) const
{
arSuggestions.RemoveAll();
if (wordInfo.m_nColorBlock == -1)
{
// Default text, no suggestions.
return;
}
if (wordInfo.m_strWord == _T("toobar"))
{
arSuggestions.Add(_T("toolbar"));
arSuggestions.Add(_T("toolbox"));
arSuggestions.Add(_T("2 bars"));
}
else if (wordInfo.m_strWord == _T("examle"))
{
arSuggestions.Add(_T("example"));
}
arCustomActions.Add(_T("&Ignore All"));
arCustomActions.Add(_T("&Add to Dictionary"));
}