Posted to tcl by aspect at Wed Jul 01 08:12:46 GMT 2015view pretty
# itext - can't move insertion cursor # nstext - can't select package require Tk package require snit package provide itext 0.1 ::snit::widgetadaptor itext { constructor {args} { installhull using text # Apply an options passed at creation time. $self configurelist $args } delegate method Mark to hull as mark method mark {cmd args} { if {$cmd eq "set" && [lindex $args 0] eq "insert"} { puts "$self $cmd {*}$args" return } $self Mark $cmd {*}$args } # Pass all other methods and options to the real text widget, so # that the remaining behavior is as expected. delegate method * to hull delegate option * to hull } ::snit::widgetadaptor nstext { constructor {args} { installhull using text # Apply an options passed at creation time. $self configurelist $args } delegate method Tag to hull as tag method tag {cmd args} { if {$cmd eq "add" && [lindex $args 0] eq "sel"} { puts "$self $cmd {*}$args" return } $self Tag $cmd {*}$args } # Pass all other methods and options to the real text widget, so # that the remaining behavior is as expected. delegate method * to hull delegate option * to hull } pack [itext .i] pack [nstext .ni]