Artifact
7ee4945aa096c1221ce7a6a9b8c788773edca49d:
Attachment "rotext-0.1.tm" to
ticket [3480882fff]
added by
daapp
2012-01-28 18:44:56.
package require Tk
package require snit
package require widget::scrolledtext
# 2011 (c) Alexander Danilov <[email protected]>
# Example at the end of file
snit::widgetadaptor widget::rotext {
delegate option * to hull
delegate method * to hull
constructor args {
installhull using widget::scrolledtext
foreach t [bind Text] {
if {! [string match *Key* $t] && $t ni {<<Paste>> <<PasteSelection>> <<Clear>> <<Cut>>}} {
bind ROText $t [bind Text $t]
}
}
bind ROText <Control-Key-Tab> [bind Text <Control-Key-Tab>]
bindtags $win.text [linsert [lsearch -all -inline -not [bindtags $win] Text] 1 ROText]
$self configurelist $args
}
}
if {[file tail $::argv0] == [info script]} {
entry .e1
entry .e2
widget::rotext .t -bg lightblue
entry .e3
pack .e1 .e2 .t .e3
bind . <Escape> exit
.t insert end "Try to\n input something\n here, cut\n or paste text."
.t delete 1.0 2.0
}