[WJG] (29/03/08) Although the default GTK text offering lacks some of the flexibility of its Tk counterpart, none-the-less it is still quite a useful widget. In this example, clicking Button-3 over the tagged text will result in a placing a popup menu over the tag, with a few choices that will enable the colour of the tag to be changes. A Button-3 click elsewhere will result in the default Gtk popup menu. A feature which the GTK widget has that the Tk counterpart doesn't is the cut and past of rich text. #--------------- # popup.tcl #--------------- #!/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" package require Gnocl #--------------- # create a menu, can be used as a popup #--------------- set menu [gnocl::menu -title "menuCheckItem" -tearoff 0] $menu add [gnocl::menuItem -text "%_Red" -onClicked {setClr $text red} ] $menu add [gnocl::menuItem -text "%_Green" -onClicked {setClr $text green} ] $menu add [gnocl::menuItem -text "%_Blue" -onClicked {setClr $text blue} ] #--------------- # somthing for our menus to do when selected #--------------- proc setClr {w clr} { $w tag configure bold -foreground $clr } #--------------- # create a sample window and insert some tagged text #--------------- set text [gnocl::text ] $text tag create bold \ -fontWeight bold \ -foreground blue \ -onEvent { # the GTk text widget tag only returns a limited range of events # ie. mouse button three, this will override the Gnome default popup if {%b == "3"} {$menu popup} } $text insert end "This is " $text insert end "Gnocl" -tags bold $text insert end "!" ---- !!!!!! %| enter categories here |% !!!!!!