[Richard Suchenwirth] 2002-07-29 - The behavior of some shells (even including cmd.exe!) to complete commands or filenames on is occasionally asked from Tcl too. Here is a quick shot of a mini-console with an entry, that does command completion, a label where multiple alternatives are shown, and a text widget where the command and its result (or error message) are displayed when was hit: ---- proc complete {varName infoName} { upvar 1 $varName var upvar 1 $infoName info if {[llength $var]==1} { set cmds [info commands $var*] if {[llength $cmds]==1} { set var "$cmds " } elseif {[llength $cmds]>1} { set info [lsort $cmds] } else bell } } entry .e -textvar entry bind .e {complete entry info; %W icursor end; break} bind .e {catch $entry res; .t insert end "%% $entry\n$res\n"} label .info -textvar info -anchor w -width 60 text .t pack .e .info .t -fill x -expand 1 ---- [Arts and crafts of Tcl-Tk programming]