Please note: We are no longer the owners of the Spell Checking plugin. More information to follow.
Spell checking for your Xojo Mac OS X and Windows applications has never been easier. The BKS Spell Checker plugin lets Xojo Developers quickly, and easily, add spell check capabilities to their application. Xojo developers have two options when using the BKS Spell Checker plugin. The first option: All developers can use Hunspell dictionaries. This allows you to use any of the hundreds of Hunspell dictionaries that are available and most of them are free (some have some licensing issue). The second option: Mac OS X and Windows 8 applications can use the system spell checkers. Hunspell spell checking is used by many popular software packages including LibreOffice, OpenOffice.org, Mozilla Firefox 3 & Thunderbird, Google Chrome, and it is also used by proprietary software packages, like Mac OS X, InDesign, and many others. More information is available at http://hunspell.sourceforge.net
Works with Text Area and Text Field
BKS Spell Checker works with any string as long as you can feed it either a word or a block of text. It’s up to you to provide an interface in your app for learning words and selecting a replacement word from the list of suggestions, but feel free to use the UI we’ve provided in any of the demo apps.
Works with Formatted Text Control
The Formatted Text Control works with BKS Spell Checker. In fact, FTC comes with the BKS Spell Checker plugin. Download the Demo Plugin now and start working with it. The demo plugin is fully functional but if put into a non-debug application will generate an exception when accessed.
Requirements:
- Xojo 2013 R1 or better
- This plugin will not work in Real Studio
- Mac OS X
- Varies depending upon which version of Xojo
- Windows
- Hunspell spell checker works on Windows XP and above
- System spell checker works on Windows 8 and above
Example Source Code:
Creating a new Hunspell Spell Checker
Try
moSpell = BKSSpellChecker.CreateSystemChecker catch ex as PlatformNotSupportedException
MsgBox “Platform Not Supported”
Quit
EndTry
Creating a new System Spell Checker dim fDict as FolderItem = GetFolderItem(“en_US”).Child(“en_US.dic”) dim fAff as FolderItem = GetFolderItem(“en_US”).Child(“en_US.aff”)
//For Spanish
‘dim fDict as FolderItem = GetFolderItem(“spanish”).Child(“spanish.dic”)
‘dim fAff as FolderItem = GetFolderItem(“spanish”).Child(“spanish.aff”)
if fDict = nil or fDict.Exists = false then
MsgBox “Could not locate the dictionary file.”
Quit
endif
if fAff = nil or fAff.Exists = false then
MsgBox “Could not locate the Affix file.“
Quit
endif
//Try to create HunspellChecker
Try
moSpell = BKSSpellChecker.CreateHunspellChecker(fDict,fAff) catch ex as RuntimeException
MsgBox “Could not create Spell Checker”
Quit
EndTry
Spell Checking a Single Word if app.SpellCheck.IsWordSpelledCorrectly(txtWord.text) then
MsgBox “Spelled Correctly”
else
Msgbox “Misspelled”
end
Spell Checking a Block of Text dim iStart as Integer = 1 dim sText as string = txtSpellCheck.Text dim iTextLen as integer = sText.Len dim aroRange() as BKSSpecllCheckerRange while iStart < iTextLen dim oRange as BKSSpellCheckerRange oRange = app.SpellCheck.CheckSpelling(sText, iStart)
if oRange = nil then exit while
dim sWord as string = sText.Mid(oRange.Start,oRange.Length)
//Add to array of misspelled words
aroRange.append oRange
//Add to listbox showing word, range, length
lstWords.AddRow sWord, str(oRange.Start), str(oRange.Length) iStart = oRange.Start + oRange.Length
wend
FAQ:
Q: Why no Linux version? A: Frankly, the number of Linux users that contact us for products and client work tells us that it’s not a worthwhile investment of our time. Prove us wrong and place an order for the Linux version!
Q: Does this replace the Spell Check Utilities plugin? A: Yes, but it’s not a direct replacement. If you are a SCU owner, please contact us so we can transition you to the new plugin.