gnocl::text - obtaining names of tags applied to specific locations

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]]
    }

Comments

Popular posts from this blog

gnocl::list add

Recent Changes, April 2019

Gnocl Gtk3+ implementation begun!