Platforms to show: All Mac Windows Linux Cross-Platform
/WinFrameworks/Windows Spell Checker
Required plugins for this example: MBS WinFrameworks Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /WinFrameworks/Windows Spell Checker
This example is the version from Fri, 8th Apr 2021.
Project "Windows Spell Checker.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control LangButton Inherits PushButton
ControlInstance LangButton Inherits PushButton
EventHandler Sub Action()
dim languages() as string = WinSpellCheckerMBS.SupportedLanguages
Msgbox join(languages, EndOfLine)
End EventHandler
End Control
Control InputField Inherits TextField
ControlInstance InputField Inherits TextField
End Control
Control CheckButton Inherits PushButton
ControlInstance CheckButton Inherits PushButton
EventHandler Sub Action()
dim errors() as WinSpellingErrorMBS = SpellChecker.Check(InputField.text)
for each error as WinSpellingErrorMBS in errors
msgbox "at "+str(error.StartIndex)+" with length "+str(error.Length)+" has replacement: "+error.Replacement
next
End EventHandler
End Control
Control ComprehensiveCheckButton Inherits PushButton
ControlInstance ComprehensiveCheckButton Inherits PushButton
EventHandler Sub Action()
dim errors() as WinSpellingErrorMBS = SpellChecker.ComprehensiveCheck(InputField.text)
for each error as WinSpellingErrorMBS in errors
msgbox "at "+str(error.StartIndex)+" with length "+str(error.Length)+" has replacement: "+error.Replacement
next
End EventHandler
End Control
Control SuggestButton Inherits PushButton
ControlInstance SuggestButton Inherits PushButton
EventHandler Sub Action()
dim suggestions() as string = SpellChecker.Suggest(InputField.Text)
msgbox join(suggestions, EndOfLine)
End EventHandler
End Control
EventHandler Sub Open()
dim enUSsupported as Boolean = WinSpellCheckerMBS.IsSupported("en-US")
if not enUSsupported then
msgbox "en-US not supported as language?"
else
SpellChecker = new WinSpellCheckerMBS("en-US")
Title = Title + ": "+SpellChecker.LocalizedName
// learn a new word
SpellChecker.add "MonkeybreadSoftware"
// ignore this word
SpellChecker.Ignore "FileMaker"
// and remove one
'SpellChecker.Remove "MonkeybreadSoftware"
end if
End EventHandler
Property SpellChecker As WinSpellCheckerMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
See also:
The items on this page are in the following plugins: MBS WinFrameworks Plugin.