19. Feb 2003 / [MSW]. ---- The question on [Ask, and it shall be given.] was how to allow people resizing windows to do this exactly, preferrably by a label which displays the exact dimensions on the window being resized. Well, I digged some but could not find a fitting binding for use with [bind], nor the fitting protocol thing for use with ''[wm] protocol''. So I suggested to use a little panel instead, well, this is my shot at it. ---- ''(Yes, it needs wrapping its own namespace, allow multiple instances of itself, track the windows being resized, and some descriptive labels, those are still to come)'' ---- proc sizepanel {toplvl} { toplevel .szpan foreach {minx miny} [wm minsize $toplvl] {} foreach {maxx maxy} [wm maxsize $toplvl] {} scan [wm geometry $toplvl] {%dx%d} w h entry .szpan.w -textvar ::szpan(w$toplvl) entry .szpan.h -textvar ::szpan(h$toplvl) scale .szpan.sw -variable ::szpan(w$toplvl) -from $minx -to $maxx -orient h scale .szpan.sh -variable ::szpan(h$toplvl) -from $miny -to $maxy -orient h button .szpan.k -text "Done" -command \ "catch {unset ::szpan(w$toplvl); unset ::szpan(h$toplvl)} ; destroy .szpan" grid .szpan.w .szpan.sw grid .szpan.h .szpan.sh grid .szpan.k -columnspan 2 set ::szpan(h$toplvl) $h set ::szpan(w$toplvl) $w trace variable ::szpan w sztrace trace variable ::szpan w sztrace } proc sztrace {var1 var2 op} { upvar ${var1}($var2) v scan $var2 {%1s%s} dir win if {$dir == "w"} then { szx $win $v } else { szy $win $v } } proc szx {win newx} { scan [wm geometry $win] {%dx%d} w h wm geometry $win "${newx}x${h}" } proc szy {win newy} { scan [wm geometry $win] {%dx%d} w h wm geometry $win "${w}x${newy}" } ---- Use with sizepanel , e.g. % sizepanel . ----