Posted to tcl by emiliano at Wed Dec 18 14:03:00 GMT 2019view raw
- namespace eval ::roText {
- proc roText {w args} {
- text $w {*}$args
- rename $w ::roText::$w
- proc ::$w {cmd args} [format {
- set w %s
- if {$cmd ni "insert delete"} {
- ::roText::$w $cmd {*}$args
- }
- } $w]
- bind $w <Destroy> [list rename $w {}]
- }
- }
- # testing
- package require Tk
- roText::roText .txt
- pack .txt
- .txt insert end "This is a test"; #nothing happens
- after 5000 {roText::.txt insert end "Insert using the widget command"}