ulis, 2002-07-21: the goal is to overwrite the chars of an entry, one by one. ---- # creating the entry widget pack [entry .e] # focusing the entry widget focus -force .e # binding to key press # the following break avoid the interpretation # by the Entry class associated routine # (defined inside entry.tcl) bind .e { overwrite %A; break } # overwriting proc proc overwrite {ch} \ { if {[string is control $ch]} \ { # for a control char, we need to bypass the break # so the standard routine is called to handle the char return -code return } \ else \ { # for a standard char # ::n is updated if needed set i [.e index insert] if {$i != $::n} { set ::n $i } # overwriting the char .e delete $::n .e insert $::n $ch # selecting the next char prepare } } # selecting next proc proc prepare {} \ { incr ::n .e icursor $::n .e selection from $::n .e selection to [expr {$::n + 1}] } ---- # the test # initial string .e insert 0 "the initial string" # selecting the first char set ::n -1 prepare Now, type ahead! ----