[WJG] (18/10/08) The Gtk way of event handling within text widgets is slightly different than in Tk. This, however, doesn't mean that we can can't get the same effects. One such feature commonly encountered in Tk applications is rollover effects on tagged text. Gtk has excellent support for signals but not all of these are inherited completely. In some of my applications I like to differentiate tagged text as the mouse pointer skims across a window. Ok, its not absolutely necessary but, I 'grew-up' with Tk and still like its distinctive features. So, here's the way to achieve the same effect responding to the Gtk motionNotify signal. It is not an perfect solution, there is no means of determining whether a tagged are is 'entered' or 'left', simply if the tag has been crossed. Here's the code: ---- # tagRollover.tcl #!/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" package require Gnocl set text [gnocl::text ] $text configure -onChanged { puts "changed" $text tag apply {0 0} end -tags _tag_default } # some global parameters.. set _tag_rollOver(baseClr) blue set _tag_rollOver(highlight) red set _tag_rollOver_active "" set j 0 $text tag create _tag_default \ -onEvent { set t %t set w %w if { $t == "motionNotify" } { if {$_tag_rollOver_active != ""} { $w tag configure $_tag_rollOver_active -foreground $_tag_rollOver(baseClr) set _tag_rollOver_active "" } } } # create new, rollOver tag $text tag create _tag_rollOver_[incr j] \ -fontWeight bold \ -foreground $_tag_rollOver(baseClr) \ -onEvent { set t %t set w %w if { $t == "motionNotify" } { $w tag configure %n -foreground $_tag_rollOver(highlight) set _tag_rollOver_active %n } } # use it $text insert end "This is " ;#-tags _tag_default $text insert end "Gnocl" -tags _tag_rollOver_$j $text insert end "! \n" ;#-tags _tag_default # create further tags, this could be done under program control e.g. as a button formatting command. $text tag create _tag_rollOver_[incr j] \ -fontWeight bold \ -foreground $_tag_rollOver(baseClr) \ -onEvent { set t %t set w %w if { $t == "motionNotify" } { $w tag configure %n -foreground $_tag_rollOver(highlight) set _tag_rollOver_active %n } } # use it $text insert end "This too is " ;#-tags _tag_default $text insert end "Gnocl" -tags _tag_rollOver_2 $text insert end "! \n" ;#-tags _tag_default gnocl::window -title "Text TagRollover Effext" -child $text gnocl::mainLoop ---- !!!!!! %| enter categories here |% !!!!!!