GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Apr 17, 2014 10:39 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Adding GtkSpellCheck functionality to a GtkWidget in Gnocl
PostPosted: Tue Jan 05, 2010 4:31 pm 
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]


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group