global V if ![info exists V] {set V 1} # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # This little routine creates a verbose-level widget and packs it in w to the # # right. We depend on there being a global verbosity variable V, which we # # will create if it doesn't exist already. The args, if any, are included in # # the menubutton option list, so the caller can do things like specify # # border, relief, font, colors, etc. See also Vbg.w for another version. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # proc Verbose {w args} { global V F R namN if ![info exists V] {set V 1} if ![info exists F] {set F 3} if ![info exists R] {set R ridge} eval frame $w.fVbs -bd $F -relief $R eval menubutton $w.fVbs.m $args -text V -menu $w.fVbs.m.menu -bd 0 -pady 0 eval entry $w.fVbs.v -textvariable V -width 1 -bd 0 -highlightthickness 0 eval pack $w.fVbs.m $w.fVbs.v -in $w.fVbs -side left eval menu $w.fVbs.m.menu -activeborderwidth 0 $w.fVbs.m.menu add command -label {Incr} -command {incr V} $w.fVbs.m.menu add command -label {Decr} -command {incr V -1} $w.fVbs.m.menu add command -label {Quiet} -command {set V 1} $w.fVbs.m.menu add command -label {Silent} -command {set V 0} pack $w.fVbs -in $w -side right } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Here's a routine that appends a message to the .verbose.t.txt widget, if it # # exists, otherwise writes to stdout. Several applications that use this # # package also call [txtWin .verbose ...] to create the .verbose window, and # # for those apps, we write to the .verbose window. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # proc Vmsg {m} { if [winfo exists .verbose] { .verbose.t.txt insert end $m\n } else { puts $m } }