WJG (12-Apr-09) The GtkSpell extension is a really useful tool that will check the input of any GtkTextView widget and mark up dubious words. If a mispelling is detected, the word will be tagged and underlined with a red zig-zag. Then, simply click MB-3 and a popup menu will appear with a range of suggested corrections. Here's the script to show how its done:
# GtkSpell_TEST.tcl #!/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" package require Gnocl set but1 [gnocl::toggleButton \ -text "%#SpellCheck" \ -variable sc \ -value 1 \ -onValue 1 \ -offValue 0 \ -onToggled { $txt1 configure -spellCheck $sc }] set txt1 [gnocl::text -spellCheck 1 ] set box [gnocl::box -orientation vertical -align left] $box add $but1 -fill {1 0} -expand 0 $box add $txt1 -fill {1 1} -expand 1 set win [gnocl::window -title "GtkSpell Demo" -child $box ] gnocl::mainLoop
And here's the screen shot.
D. McC 2009 Apr 13: Great! From the code, it appears that this "extension" is actually part of the Gnocl core, since you can create the toggleButton and the spell-checking text widget as soon as you've invoked "package require Gnocl"--is that right? And it's new with Gnocl 0.9.94, right?
WJG (13-Apr-90) Well, the feature is still part of my development code. The GtkSpell package is relatively simple but I will spend a little more time on it beforehand. Interestingly, the GtkSpell is a bolt-on to the GtkTextView and might not necessarily be a default installation option with many Linux distros -check with the Puppy developers. If necessary, I can modify the Gnocl source to create a separate package for the spellchecker. But it does look promising doesn't it?
D. McC 2009 Apr 13: Yes! How are the correctly spelled words stored, and can users add words to the list?
WJG GtkSpell [L1 ] uses Enchant [L2 ] which interfaces to a whole pile of spellcheck engines of which Hunspell [L3 ] is most highly regarded. From the GtkSpell docs there is no direct support maintaining dictionaries but it is possible to "add" words to the "dictionary" wherever that is located as shown in this screen shot:
.
Personally, I feel that dictionary management is a necessary feature of the overall package, so a little more research will be needed here (probably resulting in a Tcl binding to Hunspell).