Wednesday, June 27, 2012

gnocl::text -- getSelectionBounds

Just added new command to the text widget functionality to retrieve the bounds of the text buffer selection. If there is no selection, then an empty string is returned, otherwise there is a list of four integers, in the form startRow startCol endRow endCol.

#---------------
# test-selectionBounds.tcl
#---------------
#!/bin/sh
#\
exec tclsh "$0" "$@"
package require Gnocl

set txt [gnocl::text -wrapMode word]
$txt configure -onButtonRelease {
    puts [%w getSelectionBounds]
    }

$txt lorem
   
gnocl::window -child $txt -setSize 0.25


No comments: