|
Heres another simple demo to show how easy it is to create Gtk+ compliant bindings with Gnocl. A quick scan over the options themselves should 'tell the story' of just what's happening.
[code=]
#---------------
# SpellCheck.tcl
#---------------
# Created by William J Giddings
# 31-Oct-2009
#---------------
# Description:
# Demonstrates spell checking functionality.
#---------------
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
package require Gnocl
package require GnoclSpellCheck
set sc 0 ;# define a global variable for the toggle button
set but1 [gnocl::toggleButton \
-text "%#SpellCheck" \
-variable sc \
-value 0 \
-onValue 1 \
-offValue 0 \
-onToggled {
if {$sc} {
gnocl::spellcheck on $txt1
} else {
gnocl::spellcheck off $txt1
} } ]
set txt1 [gnocl::text -wrapMode word]
set box [gnocl::box -orientation vertical -align left]
$box add $but1 -fill {0 0} -expand 0 -align left
$box add $txt1 -fill {1 1} -expand 1
set win [gnocl::window \
-title "GtkSpell Demo" \
-child $box \
-onDestroy { exit } \
-defaultWidth 320 \
-defaultHeight 200]
$txt1 insert end "How noo broon cow.\n"
$txt1 insert end "A proper ceep of cffee from a prper cpper coffee pit.\n"
set sc 1 ;# turn on spellcheck by default
gnocl::spellcheck on $txt1 ;# turn on the spellchecking by default
gnocl::mainLoop
[/code]
|