The following script shows how to obtain details of which tag applies to a particular position in a block of text.
#---------------
# test-tag-get.tcl
#---------------
#!/bin/sh
#\
exec tclsh "$0" "$@"
package require Gnocl
set txt [gnocl::text -baseFont {Serif 14}]
$txt tag create red -foreground red
$txt tag create black -foreground black
$txt tag create bold -fontWeight bold
gnocl::window -child $txt -setSize 0.25
$txt insert end "the quick brown fox " -tags red
$txt insert end "jumps " -tags {red bold black}
$txt insert end "over the lazy dog" -tags red
$txt configure -onKeyRelease {
puts [%w tag get [%w getCursor]]
}
$txt configure -onButtonRelease {
puts [%w tag get [%w getCursor]]
}
#---------------
# test-tag-get.tcl
#---------------
#!/bin/sh
#\
exec tclsh "$0" "$@"
package require Gnocl
set txt [gnocl::text -baseFont {Serif 14}]
$txt tag create red -foreground red
$txt tag create black -foreground black
$txt tag create bold -fontWeight bold
gnocl::window -child $txt -setSize 0.25
$txt insert end "the quick brown fox " -tags red
$txt insert end "jumps " -tags {red bold black}
$txt insert end "over the lazy dog" -tags red
$txt configure -onKeyRelease {
puts [%w tag get [%w getCursor]]
}
$txt configure -onButtonRelease {
puts [%w tag get [%w getCursor]]
}
Comments