Version 5 of Spellchecking the Contents of the gnocl::text Widget.

Updated 2009-04-13 12:39:43 by wjg

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.

http://wjgiddings.googlepages.com/Screenshot-GtkSpellDemo.png


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?


enter categories here